File: server_receive.py

package info (click to toggle)
python-socketio 5.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,140 kB
  • sloc: python: 11,460; makefile: 13; sh: 7
file content (21 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import time
import socketio


def test():
    s = socketio.Server(async_handlers=False)
    start = time.time()
    count = 0
    s._handle_eio_connect('123', 'environ')
    s._handle_eio_message('123', '0')
    while True:
        s._handle_eio_message('123', '2["test","hello"]')
        count += 1
        if time.time() - start >= 5:
            break
    return count


if __name__ == '__main__':
    count = test()
    print('server_receive:', count, 'packets received.')