• Home
  • Raw
  • Download

Lines Matching full: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."
128 errorTab[10038] = "Socket operation on nonsocket."
131 errorTab[10041] = "Protocol wrong type for socket."
134 errorTab[10044] = "Socket type not supported."
146 errorTab[10056] = "Socket is already connected."
147 errorTab[10057] = "Socket is not connected."
214 class socket(_socket.socket): class
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)
602 raise ValueError("Only AF_INET and AF_INET6 socket address families "
605 raise ValueError("Only SOCK_STREAM socket type is supported")
609 # We create a connected TCP socket. Note the trick with
611 lsock = socket(family, type, proto)
617 csock = socket(family, type, proto)
643 # if either socket isn't connected.
657 a = socket(family, type, proto, a.detach())
658 b = socket(family, type, proto, b.detach())
665 socketpair.__doc__ = """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
666 Create a pair of socket objects from the sockets returned by the platform
668 The arguments are the same as for socket() except the default family is AF_UNIX
679 the raw I/O interface on top of a socket object.
685 # write() on a socket handle)
686 # - it wouldn't work with socket timeouts (FileIO would ignore the
687 # timeout and consider the socket non-blocking)
705 the number of bytes read. If the socket is non-blocking and no bytes
727 """Write the given bytes or bytearray object *b* to the socket
729 len(b) if not all data could be written. If the socket is
746 raise ValueError("I/O operation on closed socket.")
753 raise ValueError("I/O operation on closed socket.")
760 raise ValueError("I/O operation on closed socket.")
764 """Return the file descriptor of the underlying socket.
782 socket, except if all references to it have disappeared.
822 """Connect to *address* and return the socket object.
825 port)``) and return the socket object. Passing the optional
826 *timeout* parameter will set the timeout on the socket instance
830 for the socket to bind as a source address before making the connection.
842 sock = socket(af, socktype, proto)
872 """Return True if the platform supports creating a SOCK_STREAM socket
880 with socket(AF_INET6, SOCK_STREAM) as sock:
889 """Convenience function which creates a SOCK_STREAM type socket
890 bound to *address* (a 2-tuple (host, port)) and return the socket
894 *backlog* is the queue size passed to socket.listen().
895 *reuse_port* dictates whether to use the SO_REUSEPORT socket option.
897 create an AF_INET6 socket able to accept both IPv4 or IPv6
913 sock = socket(family, SOCK_STREAM)
917 # previous closed socket on the same address and still in
919 # 2) If set, another socket is free to bind() on the same
960 all the necessary arguments for creating a socket connected to that service.
971 # and socket type values to enum constants.