Skip to content

Instantly share code, notes, and snippets.

@c4software
Created April 28, 2016 20:30
Show Gist options
  • Save c4software/f46e9422427c395b97f2ed1b617aff01 to your computer and use it in GitHub Desktop.
Save c4software/f46e9422427c395b97f2ed1b617aff01 to your computer and use it in GitHub Desktop.
import asyncio
@asyncio.coroutine
def callback(reader, writer):
while True:
data = yield from reader.readline()
writer.write(data)
yield from writer.drain()
srv = asyncio.start_server(callback, '', 8000)
loop = asyncio.get_event_loop()
print ("Listen on 0.0.0.0:8000")
server = loop.run_until_complete(srv)
loop.run_forever()
@c4software
Copy link
Author

c4software commented Apr 28, 2016

Echo Serveur async en Python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment