On this page
asyncio.AbstractServer
Prev: asyncio.AbstractEventLoop | Up: asyncio | Next: asyncio.all_tasks
Rel: asyncio.AbstractEventLoop, asyncio.all_tasks, asyncio.as_completed, asyncio.Barrier
Ref: docs.python.org — asyncio.AbstractServer
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import AbstractServer
Signature & Overview
asyncio.AbstractServer()
Abstract server returned by create_server().
Methods & Attributes
AbstractServer.abort_clients(self)— Close all active connections immediately.AbstractServer.close(self)— Stop serving. This leaves existing connections open.AbstractServer.close_clients(self)— Close all active connections.AbstractServer.get_loop(self)— Get the event loop the Server object is attached to.AbstractServer.is_serving(self)— Return True if the server is accepting connections.AbstractServer.serve_forever(self)— Start accepting connections until the coroutine is cancelled.AbstractServer.start_serving(self)— Start accepting connections.AbstractServer.wait_closed(self)— Coroutine to wait until service is closed.
Usage
import asyncio
# Returned by loop.create_server() and asyncio.start_server()
assert hasattr(asyncio.AbstractServer, "serve_forever")
Gotchas
- Use as an async context manager:
async with server:closes listening sockets and awaitswait_closed()cleanly on exit.
REPL Inspect
from asyncio import AbstractServer
help(AbstractServer)
Linked from
- tuts/python3/stdlib_module/asyncio
- tuts/python3/stdlib_module/asyncio/AbstractEventLoop
- tuts/python3/stdlib_module/asyncio/all_tasks
- tuts/python3/stdlib_module/asyncio/as_completed
- tuts/python3/stdlib_module/asyncio/Barrier
- tuts/python3/stdlib_module/asyncio/BaseEventLoop
- tuts/python3/stdlib_module/asyncio/BaseProtocol
- tuts/python3/stdlib_module/asyncio/BaseTransport
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore
- tuts/python3/stdlib_module/asyncio/BrokenBarrierError
- tuts/python3/stdlib_module/asyncio/BufferedProtocol
- tuts/python3/stdlib_module/asyncio/CancelledError
- tuts/python3/stdlib_module/asyncio/capture_call_graph
- tuts/python3/stdlib_module/asyncio/Condition
- tuts/python3/stdlib_module/asyncio/create_eager_task_factory
- tuts/python3/stdlib_module/asyncio/create_subprocess_exec
- tuts/python3/stdlib_module/asyncio/create_subprocess_shell
- tuts/python3/stdlib_module/asyncio/create_task
- tuts/python3/stdlib_module/asyncio/current_task
- tuts/python3/stdlib_module/asyncio/DatagramProtocol
- tuts/python3/stdlib_module/asyncio/DatagramTransport
- tuts/python3/stdlib_module/asyncio/eager_task_factory
- tuts/python3/stdlib_module/asyncio/ensure_future
- tuts/python3/stdlib_module/asyncio/Event
- tuts/python3/stdlib_module/asyncio/EventLoop
- tuts/python3/stdlib_module/asyncio/format_call_graph
- tuts/python3/stdlib_module/asyncio/FrameCallGraphEntry
- tuts/python3/stdlib_module/asyncio/Future
- tuts/python3/stdlib_module/asyncio/future_add_to_awaited_by
- tuts/python3/stdlib_module/asyncio/future_discard_from_awaited_by
- tuts/python3/stdlib_module/asyncio/FutureCallGraph
- tuts/python3/stdlib_module/asyncio/gather
- tuts/python3/stdlib_module/asyncio/get_event_loop
- tuts/python3/stdlib_module/asyncio/get_event_loop_policy
- tuts/python3/stdlib_module/asyncio/get_running_loop
- tuts/python3/stdlib_module/asyncio/Handle
- tuts/python3/stdlib_module/asyncio/IncompleteReadError
- tuts/python3/stdlib_module/asyncio/iscoroutine
- tuts/python3/stdlib_module/asyncio/iscoroutinefunction
- tuts/python3/stdlib_module/asyncio/isfuture
- tuts/python3/stdlib_module/asyncio/new_event_loop
- tuts/python3/stdlib_module/asyncio/open_connection
- tuts/python3/stdlib_module/asyncio/open_unix_connection
- tuts/python3/stdlib_module/asyncio/print_call_graph
- tuts/python3/stdlib_module/asyncio/run
- tuts/python3/stdlib_module/asyncio/run_coroutine_threadsafe
- tuts/python3/stdlib_module/asyncio/set_event_loop
- tuts/python3/stdlib_module/asyncio/set_event_loop_policy
- tuts/python3/stdlib_module/asyncio/shield
- tuts/python3/stdlib_module/asyncio/sleep
- tuts/python3/stdlib_module/asyncio/start_server
- tuts/python3/stdlib_module/asyncio/start_unix_server
- tuts/python3/stdlib_module/asyncio/timeout
- tuts/python3/stdlib_module/asyncio/timeout_at
- tuts/python3/stdlib_module/asyncio/to_thread
Related notes
- tuts/python3/stdlib_module/asyncio/AbstractEventLoop Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/Barrier Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/asyncio/BaseEventLoop links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseTransport links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BrokenBarrierError links to this page; shared tags: #asyncio, #stdlib