Пример #1
0
def run():
    loop = asyncio.get_event_loop()
    app = App(loop, 'qos')
    try:
        loop.run_until_complete(
            server.run(loop, {'qos'}, True, port=PORT, timeout=TIMEOUT))
    except KeyboardInterrupt:
        print('Interrupted')
    finally:
        print('Closing sockets')
        server.Connection.close_all()
Пример #2
0
def run():
    loop = asyncio.get_event_loop()
    clients = {'1', '2', '3', '4'}
    apps = [App(loop, n) for n in clients]  # Accept 4 clients with ID's 1-4
    try:
        loop.run_until_complete(server.run(loop, clients, True, port=PORT, timeout=TIMEOUT))
    except KeyboardInterrupt:
        print('Interrupted')
    finally:
        print('Closing sockets')
        server.Connection.close_all()
Пример #3
0
def run():
    clients = {'rx', 'tx'}  # Expected clients
    loop = asyncio.get_event_loop()
    apps = [App(loop, name) for name in clients]  # Accept 2 clients
    try:
        loop.run_until_complete(
            server.run(loop, clients, False, port=PORT, timeout=TIMEOUT))
    except KeyboardInterrupt:
        print('Interrupted')
    finally:
        print('Closing sockets')
        server.Connection.close_all()