Lines Matching defs:socket
23 import socket
64 _HAS_IPv6 = hasattr(socket, 'AF_INET6')
89 if not hasattr(socket, 'SO_REUSEPORT'):
90 raise ValueError('reuse_port not supported by socket module')
93 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
95 raise ValueError('reuse_port not supported by socket module, '
102 if not hasattr(socket, 'inet_pton'):
105 if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or \
109 if type == socket.SOCK_STREAM:
110 proto = socket.IPPROTO_TCP
111 elif type == socket.SOCK_DGRAM:
112 proto = socket.IPPROTO_UDP
129 if family == socket.AF_UNSPEC:
130 afs = [socket.AF_INET]
132 afs.append(socket.AF_INET6)
145 socket.inet_pton(af, host)
147 if _HAS_IPv6 and af == socket.AF_INET6:
190 if hasattr(socket, 'TCP_NODELAY'):
192 if (sock.family in {socket.AF_INET, socket.AF_INET6} and
193 sock.type == socket.SOCK_STREAM and
194 sock.proto == socket.IPPROTO_TCP):
195 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
470 """Create socket transport."""
850 addrinfo = socket.getaddrinfo(host, port, family, type, proto, flags)
865 getaddr_func = socket.getaddrinfo
872 None, socket.getnameinfo, sockaddr, flags)
877 raise ValueError("the socket must be non-blocking")
893 f"syscall sendfile is not available for socket {sock!r} "
925 if not sock.type == socket.SOCK_STREAM:
944 """Create, bind and connect one socket."""
950 sock = socket.socket(family=family, type=type_, proto=proto)
998 port: socket family AF_INET or socket.AF_INET6 depending on host (or
999 family if specified), socket type SOCK_STREAM. protocol_factory must be
1012 # already-connected socket was passed or when only a port
1047 type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self)
1054 type=socket.SOCK_STREAM, proto=proto,
1102 if sock.type != socket.SOCK_STREAM:
1117 # Get the socket from the transport because SSL transport closes
1118 # the old socket and creates a new SSL socket
1119 sock = transport.get_extra_info('socket')
1171 (e.g. Windows or SSL socket on Unix).
1283 if sock.type != socket.SOCK_DGRAM:
1296 f'socket modifier keyword arguments can not be used '
1305 elif hasattr(socket, 'AF_UNIX') and family == socket.AF_UNIX:
1317 # Directory may have permissions only to create socket.
1319 'socket %r: %r',
1333 addr, family=family, type=socket.SOCK_DGRAM,
1360 sock = socket.socket(
1361 family=family, type=socket.SOCK_DGRAM, proto=proto)
1366 socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
1411 family=0, type=socket.SOCK_STREAM,
1424 type=socket.SOCK_STREAM,
1433 family=socket.AF_UNSPEC,
1434 flags=socket.AI_PASSIVE,
1499 sock = socket.socket(af, socktype, proto)
1500 except socket.error:
1504 'socket.socket(%r, %r, %r)',
1510 socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
1514 # default on Linux) which makes a single socket
1517 af == socket.AF_INET6 and
1518 hasattr(socket, 'IPPROTO_IPV6')):
1519 sock.setsockopt(socket.IPPROTO_IPV6,
1520 socket.IPV6_V6ONLY,
1536 if sock.type != socket.SOCK_STREAM:
1561 if sock.type != socket.SOCK_STREAM:
1580 # Get the socket from the transport because SSL transport closes
1581 # the old socket and creates a new SSL socket
1582 sock = transport.get_extra_info('socket')
1785 - 'socket' (optional): Socket instance;