MCPcopy Index your code
hub / github.com/RustPython/RustPython / create_server

Method create_server

Lib/asyncio/base_events.py:1516–1659  ·  view source on GitHub ↗

Create a TCP server. The host parameter can be a string, in that case the TCP server is bound to host and port. The host parameter can also be a sequence of strings and in that case the TCP server is bound to all hosts of the sequence. If a host appears mult

(
            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)

Source from the content-addressed store, hash-verified

1514 return infos
1515
1516 async def create_server(
1517 self, protocol_factory, host=None, port=None,
1518 *,
1519 family=socket.AF_UNSPEC,
1520 flags=socket.AI_PASSIVE,
1521 sock=None,
1522 backlog=100,
1523 ssl=None,
1524 reuse_address=None,
1525 reuse_port=None,
1526 keep_alive=None,
1527 ssl_handshake_timeout=None,
1528 ssl_shutdown_timeout=None,
1529 start_serving=True):
1530 """Create a TCP server.
1531
1532 The host parameter can be a string, in that case the TCP server is
1533 bound to host and port.
1534
1535 The host parameter can also be a sequence of strings and in that case
1536 the TCP server is bound to all hosts of the sequence. If a host
1537 appears multiple times (possibly indirectly e.g. when hostnames
1538 resolve to the same IP address), the server is only bound once to that
1539 host.
1540
1541 Return a Server object which can be used to stop the service.
1542
1543 This method is a coroutine.
1544 """
1545 if isinstance(ssl, bool):
1546 raise TypeError('ssl argument must be an SSLContext or None')
1547
1548 if ssl_handshake_timeout is not None and ssl is None:
1549 raise ValueError(
1550 'ssl_handshake_timeout is only meaningful with ssl')
1551
1552 if ssl_shutdown_timeout is not None and ssl is None:
1553 raise ValueError(
1554 'ssl_shutdown_timeout is only meaningful with ssl')
1555
1556 if sock is not None:
1557 _check_ssl_socket(sock)
1558
1559 if host is not None or port is not None:
1560 if sock is not None:
1561 raise ValueError(
1562 'host/port and sock can not be specified at the same time')
1563
1564 if reuse_address is None:
1565 reuse_address = os.name == "posix" and sys.platform != "cygwin"
1566 sockets = []
1567 if host == '':
1568 hosts = [None]
1569 elif (isinstance(host, str) or
1570 not isinstance(host, collections.abc.Iterable)):
1571 hosts = [host]
1572 else:
1573 hosts = host

Callers

nothing calls this directly

Calls 15

_start_servingMethod · 0.95
isinstanceFunction · 0.85
_check_ssl_socketFunction · 0.85
setFunction · 0.85
_set_reuseportFunction · 0.85
hasattrFunction · 0.85
strFunction · 0.85
from_iterableMethod · 0.80
socketMethod · 0.80
ServerClass · 0.70
gatherMethod · 0.45

Tested by

no test coverage detected