sock_accept is an asyncio event-loop coroutine method for accepting an incoming connection without blocking. Pass it a non-blocking socket already bound to a port, await the returned coroutine, and receive a connection socket together with the client address. section 3.5.1
Use sock_accept as the first step in an asynchronous socket server:
- Create, bind, listen on, and configure the server socket as non-blocking. section 3.5.1
- Await sock_accept with the server socket, then handle the returned connection and client address. section 3.5.1
- Continue with sock_recv and sock_sendall to receive data and send a complete response asynchronously. section 3.5.1
Waiting for a client
The basic call is `connection, address = await loop.sock_accept(socket)`. A selector-based implementation registers the server socket for read events, pauses on a future, and resumes when a client connects. section 3.5.1 section 14.5.4
connection, address = await loop.sock_accept(socket)
Inspect the minimal call pattern for accepting a connection and unpacking its result. section 3.5.1
