PyDocs

Nav

Networking and Interprocess Communication

Server

asyncio

class (source) not WASI
  • Server(loop, sockets, protocol_factory, ssl_context, backlog, ssl_handshake_timeout, ssl_shutdown_timeout=None)
Server objects are asynchronous context managers. When used in an async with statement, it’s guaranteed that the Server object is closed and not accepting new connections when the async with statement is completed:
Changed in 3.7, 3.11
  • 3.7: Server object is an asynchronous context manager since Python 3.7.
  • 3.11: This class was exposed publicly as asyncio.Server in Python 3.9.11, 3.10.3 and 3.11.
Members of Server

a

abort_clients
Close all active connections immediately.

c

close
Stop serving.
close_clients
Close all active connections.

g

get_loop
Get the event loop the Server object is attached to.

i

is_serving
Return True if the server is accepting connections.

s

serve_forever
Start accepting connections until the coroutine is cancelled.
sockets
List of socket-like objects, asyncio.trsock.TransportSocket, which the server is listening on.
start_serving
Start accepting connections.

w

wait_closed
Wait until server is closed and all connections are dropped.
0 Examples
No examples for asyncio/Server.
See Also
No see-alsos for asyncio/Server
0 Notes
No notes for Server