Created
October 17, 2022 20:20
-
-
Save tamert/6b1807e6e2faa4456d814efc122fbb76 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 | |
async def hello(reader, writer): | |
data = await reader.read(100) | |
writer.write(b'hello world!') | |
await writer.drain() | |
writer.close() | |
async def main(): | |
server = await asyncio.start_server(hello, '127.0.0.1', 80) | |
async with server: | |
await server.serve_forever() | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment