Created
April 28, 2016 20:30
-
-
Save c4software/f46e9422427c395b97f2ed1b617aff01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Echo Serveur async en Python