Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Asyncio built-in Socket Server] #python #python3 #asyncio #server #socket #web #http
import asyncio
async def handle_request(reader, writer):
writer.write("hello world".encode()) # needs to be bytes not string
async def main():
srv = await asyncio.start_server(handle_request, '', 8081)
async with srv:
await srv.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.