Lines Matching defs:socket

5 This module provides socket operations and some related functions.
8 socket are available as methods of the socket object.
12 socket() -- create a new socket object
13 socketpair() -- create a pair of new socket objects [*]
14 fromfd() -- create a socket object from an open file descriptor [*]
15 send_fds() -- Send file descriptor to the socket.
16 recv_fds() -- Receive file descriptors from the socket.
17 fromshare() -- create a socket object from data received from socket.share() [*]
27 socket.getdefaulttimeout() -- get the default timeout value
28 socket.setdefaulttimeout() -- set the default timeout value
36 SocketType -- type object for socket objects
42 AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
43 SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
69 # Set up the socket.AF_* socket.SOCK_* constants as members of IntEnums for
73 # where needed (e.g. .family property of a socket object).
125 errorTab[10035] = "The socket operation would block."
131 errorTab[10041] = "Protocol wrong type for socket."
214 class socket(_socket.socket):
216 """A subclass of _socket.socket adding the makefile() method."""
222 # for the underlying _socket.socket they're just integers. The
223 # constructor of _socket.socket converts the given argument to an
232 _socket.socket.__init__(self, family, type, proto, fileno)
244 """Wrap __repr__() to reveal the real class name and socket
277 """dup() -> socket object
279 Duplicate the socket. Return a new socket object connected to the same
280 system resource. The new socket is non-inheritable.
288 """accept() -> (socket object, address info)
290 Wait for an incoming connection. Return a new socket
295 sock = socket(self.family, self.type, self.proto, fileno=fd)
297 # socket had a (non-zero) timeout, force the new socket in blocking
298 # mode to override platform-specific socket flags inheritance.
305 """makefile(...) -> an I/O stream connected to the socket
391 # Block until the socket is ready to send some
474 not a regular file socket.send() will be used instead.
481 The socket must be of SOCK_STREAM type.
495 def _real_close(self, _ss=_socket.socket):
508 Close the socket object without closing the underlying file descriptor.
517 """Read-only access to the address family for this socket.
523 """Read-only access to the socket type.
537 get_inheritable.__doc__ = "Get the inheritable flag of the socket"
538 set_inheritable.__doc__ = "Set the inheritable flag of the socket"
541 """ fromfd(fd, family, type[, proto]) -> socket object
543 Create a socket object from a duplicate of the given file
544 descriptor. The remaining arguments are the same as for socket().
547 return socket(family, type, proto, nfd)
549 if hasattr(_socket.socket, "sendmsg"):
555 Send the list of file descriptors fds over an AF_UNIX socket.
561 if hasattr(_socket.socket, "recvmsg"):
583 if hasattr(_socket.socket, "share"):
585 """ fromshare(info) -> socket object
587 Create a socket object from the bytes object returned by
588 socket.share(pid).
590 return socket(0, 0, 0, info)
596 """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
598 Create a pair of socket objects from the sockets returned by the platform
600 The arguments are the same as for socket() except the default family is
609 a = socket(family, type, proto, a.detach())
610 b = socket(family, type, proto, b.detach())
622 raise ValueError("Only AF_INET and AF_INET6 socket address families "
625 raise ValueError("Only SOCK_STREAM socket type is supported")
629 # We create a connected TCP socket. Note the trick with
631 lsock = socket(family, type, proto)
637 csock = socket(family, type, proto)
654 socketpair.__doc__ = """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
655 Create a pair of socket objects from the sockets returned by the platform
657 The arguments are the same as for socket() except the default family is AF_UNIX
668 the raw I/O interface on top of a socket object.
674 # write() on a socket handle)
675 # - it wouldn't work with socket timeouts (FileIO would ignore the
676 # timeout and consider the socket non-blocking)
694 the number of bytes read. If the socket is non-blocking and no bytes
716 """Write the given bytes or bytearray object *b* to the socket
718 len(b) if not all data could be written. If the socket is
735 raise ValueError("I/O operation on closed socket.")
742 raise ValueError("I/O operation on closed socket.")
749 raise ValueError("I/O operation on closed socket.")
753 """Return the file descriptor of the underlying socket.
771 socket, except if all references to it have disappeared.
811 """Connect to *address* and return the socket object.
814 port)``) and return the socket object. Passing the optional
815 *timeout* parameter will set the timeout on the socket instance
819 for the socket to bind as a source address before making the connection.
831 sock = socket(af, socktype, proto)
861 """Return True if the platform supports creating a SOCK_STREAM socket
869 with socket(AF_INET6, SOCK_STREAM) as sock:
878 """Convenience function which creates a SOCK_STREAM type socket
879 bound to *address* (a 2-tuple (host, port)) and return the socket
883 *backlog* is the queue size passed to socket.listen().
884 *reuse_port* dictates whether to use the SO_REUSEPORT socket option.
886 create an AF_INET6 socket able to accept both IPv4 or IPv6
902 sock = socket(family, SOCK_STREAM)
906 # previous closed socket on the same address and still in
908 # 2) If set, another socket is free to bind() on the same
949 all the necessary arguments for creating a socket connected to that service.
960 # and socket type values to enum constants.