You are here : python_3 -> socket

socket

socket.CMSG_LEN() Return the total length, without trailing padding, of an ancillary data item with associated data of the given length
socket.CMSG_SPACE() Return the buffer size needed for recvmsg() to receive an ancillary data item with associated data of the given length, along with any trailing padding
socket.create_connection() Connect to a TCP service listening on the Internet address (a 2-tuple (host, port)), and return the socket object
socket.fromfd() Duplicate the file descriptor fd (an integer as returned by a file object’s fileno() method) and build a socket object from the result
socket.fromshare() Instantiate a socket from data obtained from the socket
socket.getaddrinfo() Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service
socket.getdefaulttimeout() Return the default timeout in seconds (float) for new socket objects
socket.getfqdn() Return a fully qualified domain name for name
socket.gethostbyaddr() Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4/v6 addresse
socket.gethostbyname() Translate a host name to IPv4 address format
socket.gethostbyname_ex() Translate a host name to IPv4 address format, extended interface
socket.gethostname() Return a string containing the hostname of the machine where the Python interpreter is currently executing
socket.getnameinfo() Translate a socket address sockaddr into a 2-tuple (host, port)
socket.getprotobyname() Translate an Internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function
socket.getservbyname() Translate an Internet service name and protocol name to a port number for that service
socket.getservbyport() Translate an Internet port number and protocol name to a service name for that service
socket.htonl() Convert 32-bit positive integers from host to network byte order
socket.htons() Convert 16-bit positive integers from host to network byte order
socket.if_indextoname() Return a network interface name corresponding to an interface index number
socket.if_nameindex() Return a list of network interface information (index int, name string) tuples
socket.if_nametoindex() Return a network interface index number corresponding to an interface name
socket.inet_aton() Convert an IPv4 address from dotted-quad string format (for example, ‘123
socket.inet_ntoa() Convert a 32-bit packed IPv4 address (a bytes-like object four bytes in length) to its standard dotted-quad string representation (for example, ‘123
socket.inet_ntop() Convert a packed IP address (a bytes-like object of some number of bytes) to its standard, family-specific string representation (for example, '7
socket.inet_pton() Convert an IP address from its family-specific string format to a packed, binary format
socket.ntohl() Convert 32-bit positive integers from network to host byte order
socket.ntohs() Convert 16-bit positive integers from network to host byte order
socket.setdefaulttimeout() Set the default timeout in seconds (float) for new socket objects
socket.sethostname() Set the machine’s hostname to name
socket.socket() Create a new socket using the given address family, socket type and protocol number
socket.socketpair() Build a pair of connected socket objects using the given address family, socket type, and protocol number