A coroutine which creates a TCP server bound to host and port. The return value is a Server object which can be used to stop the service. If host is an empty string or None all interfaces are assumed and a list of multiple sockets will be returned (most likely
(
self, protocol_factory, host=None, port=None,
*, family=socket.AF_UNSPEC,
flags=socket.AI_PASSIVE, sock=None, backlog=100,
ssl=None, reuse_address=None, reuse_port=None,
keep_alive=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None,
start_serving=True)
| 359 | raise NotImplementedError |
| 360 | |
| 361 | async def create_server( |
| 362 | self, protocol_factory, host=None, port=None, |
| 363 | *, family=socket.AF_UNSPEC, |
| 364 | flags=socket.AI_PASSIVE, sock=None, backlog=100, |
| 365 | ssl=None, reuse_address=None, reuse_port=None, |
| 366 | keep_alive=None, |
| 367 | ssl_handshake_timeout=None, |
| 368 | ssl_shutdown_timeout=None, |
| 369 | start_serving=True): |
| 370 | """A coroutine which creates a TCP server bound to host and port. |
| 371 | |
| 372 | The return value is a Server object which can be used to stop |
| 373 | the service. |
| 374 | |
| 375 | If host is an empty string or None all interfaces are assumed |
| 376 | and a list of multiple sockets will be returned (most likely |
| 377 | one for IPv4 and another one for IPv6). The host parameter can also be |
| 378 | a sequence (e.g. list) of hosts to bind to. |
| 379 | |
| 380 | family can be set to either AF_INET or AF_INET6 to force the |
| 381 | socket to use IPv4 or IPv6. If not set it will be determined |
| 382 | from host (defaults to AF_UNSPEC). |
| 383 | |
| 384 | flags is a bitmask for getaddrinfo(). |
| 385 | |
| 386 | sock can optionally be specified in order to use a preexisting |
| 387 | socket object. |
| 388 | |
| 389 | backlog is the maximum number of queued connections passed to |
| 390 | listen() (defaults to 100). |
| 391 | |
| 392 | ssl can be set to an SSLContext to enable SSL over the |
| 393 | accepted connections. |
| 394 | |
| 395 | reuse_address tells the kernel to reuse a local socket in |
| 396 | TIME_WAIT state, without waiting for its natural timeout to |
| 397 | expire. If not specified will automatically be set to True on |
| 398 | UNIX. |
| 399 | |
| 400 | reuse_port tells the kernel to allow this endpoint to be bound to |
| 401 | the same port as other existing endpoints are bound to, so long as |
| 402 | they all set this flag when being created. This option is not |
| 403 | supported on Windows. |
| 404 | |
| 405 | keep_alive set to True keeps connections active by enabling the |
| 406 | periodic transmission of messages. |
| 407 | |
| 408 | ssl_handshake_timeout is the time in seconds that an SSL server |
| 409 | will wait for completion of the SSL handshake before aborting the |
| 410 | connection. Default is 60s. |
| 411 | |
| 412 | ssl_shutdown_timeout is the time in seconds that an SSL server |
| 413 | will wait for completion of the SSL shutdown procedure |
| 414 | before aborting the connection. Default is 30s. |
| 415 | |
| 416 | start_serving set to True (default) causes the created server |
| 417 | to start accepting connections immediately. When set to False, |
| 418 | the user should await Server.start_serving() or Server.serve_forever() |
no outgoing calls