Lines Matching refs:sock
21 the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
79 def bind_port(sock, host=HOST):
83 buildbot environment. This method raises an exception if the sock.family
84 is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
94 if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM:
96 if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
102 if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
112 sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
114 sock.bind((host, 0))
115 port = sock.getsockname()[1]
118 def bind_unix_socket(sock, addr):
120 assert sock.family == socket.AF_UNIX
122 sock.bind(addr)
124 sock.close()
130 sock = None
132 sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
133 sock.bind((HOSTv6, 0))
138 if sock:
139 sock.close()
154 with socket.socket(socket.AF_UNIX) as sock:
156 sock.bind(path)