MCPcopy Index your code
hub / github.com/python/cpython / _create_server_socket

Function _create_server_socket

Lib/test/test_external_inspection.py:74–81  ·  view source on GitHub ↗

Create and configure a server socket for test communication.

(port, backlog=1)

Source from the content-addressed store, hash-verified

72
73
74def _create_server_socket(port, backlog=1):
75 """Create and configure a server socket for test communication."""
76 server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
77 server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
78 server_socket.bind(("localhost", port))
79 server_socket.settimeout(SHORT_TIMEOUT)
80 server_socket.listen(backlog)
81 return server_socket
82
83
84def _wait_for_signal(sock, expected_signals, timeout=SHORT_TIMEOUT):

Calls 5

socketMethod · 0.80
setsockoptMethod · 0.45
bindMethod · 0.45
settimeoutMethod · 0.45
listenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…