Lines Matching full:sock
44 def _set_nodelay(sock):
45 if (sock.family in {socket.AF_INET, socket.AF_INET6} and
46 sock.type == socket.SOCK_STREAM and
47 sock.proto == socket.IPPROTO_TCP):
48 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
50 def _set_nodelay(sock):
70 def _make_socket_transport(self, sock, protocol, waiter=None, *,
72 return _SelectorSocketTransport(self, sock, protocol, waiter,
100 def _make_datagram_transport(self, sock, protocol,
102 return _SelectorDatagramTransport(self, sock, protocol,
166 def _start_serving(self, protocol_factory, sock,
168 self._add_reader(sock.fileno(), self._accept_connection,
169 protocol_factory, sock, sslcontext, server, backlog)
171 def _accept_connection(self, protocol_factory, sock,
179 conn, addr = sock.accept()
197 'socket': sock,
199 self._remove_reader(sock.fileno())
202 protocol_factory, sock, sslcontext, server,
354 def sock_recv(self, sock, n):
363 if self._debug and sock.gettimeout() != 0:
366 self._sock_recv(fut, False, sock, n)
369 def _sock_recv(self, fut, registered, sock, n):
372 fd = sock.fileno()
382 data = sock.recv(n)
384 self.add_reader(fd, self._sock_recv, fut, True, sock, n)
390 def sock_sendall(self, sock, data):
401 if self._debug and sock.gettimeout() != 0:
405 self._sock_sendall(fut, False, sock, data)
410 def _sock_sendall(self, fut, registered, sock, data):
411 fd = sock.fileno()
419 n = sock.send(data)
431 self.add_writer(fd, self._sock_sendall, fut, True, sock, data)
434 def sock_connect(self, sock, address):
439 if self._debug and sock.gettimeout() != 0:
442 if not hasattr(socket, 'AF_UNIX') or sock.family != socket.AF_UNIX:
444 address, family=sock.family, proto=sock.proto, loop=self)
450 self._sock_connect(fut, sock, address)
453 def _sock_connect(self, fut, sock, address):
454 fd = sock.fileno()
456 sock.connect(address)
464 self.add_writer(fd, self._sock_connect_cb, fut, sock, address)
473 def _sock_connect_cb(self, fut, sock, address):
478 err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
490 def sock_accept(self, sock):
500 if self._debug and sock.gettimeout() != 0:
503 self._sock_accept(fut, False, sock)
506 def _sock_accept(self, fut, registered, sock):
507 fd = sock.fileno()
513 conn, address = sock.accept()
516 self.add_reader(fd, self._sock_accept, fut, True, sock)
536 def _stop_serving(self, sock):
537 self._remove_reader(sock.fileno())
538 sock.close()
553 def __init__(self, loop, sock, protocol, extra=None, server=None):
555 self._extra['socket'] = sock
556 self._extra['sockname'] = sock.getsockname()
559 self._extra['peername'] = sock.getpeername()
562 self._sock = sock
563 self._sock_fd = sock.fileno()
680 def __init__(self, loop, sock, protocol, waiter=None,
682 super().__init__(loop, sock, protocol, extra, server)
1050 def __init__(self, loop, sock, protocol, address=None,
1052 super().__init__(loop, sock, protocol, extra)