zoukankan      html  css  js  c++  java
  • websocket for python

    https://github.com/aaugustin/websockets

    server.py

    #!/usr/bin/env python

    import asyncio
    import websockets

    async def send(websocket, path):
    while True:
    if not websocket.open:
    return
    name = await websocket.recv()
    await websocket.send("{}".format(name))
    print("{}".format("{}".format(name)))

    start_server = websockets.serve(send, '192.168.2.150', 8765)
    asyncio.get_event_loop().run_until_complete(start_server)
    asyncio.get_event_loop().run_forever()
  • 相关阅读:
    2016CCPC长春
    POJ 3974
    CH 1401
    POJ 1426
    hihocoder 1829
    江南OJ 1151
    POJ 3279
    POJ 3349
    POJ 3278
    ZOJ 3983
  • 原文地址:https://www.cnblogs.com/fx2008/p/6183303.html
Copyright © 2011-2022 走看看