Python socket Functions
EditRocket provides the following information on socket functions in the Python source code builder.
fromfd(fd, family, type[, proto]) - Duplicate the file descriptor fd (an integer as returned by a file object's fileno() method) and build a socket object from the result.
getaddrinfo(host, port[, family[, socktype[, proto[, flags]]]]) - Resolves the host/port argument, into a sequence of 5-tuples that contain all the necessary argument for the sockets manipulation.
getdefaulttimeout() - Return the default timeout in floating seconds for new socket objects.
getfqdn([name]) - Return a fully qualified domain name for name.
gethostbyaddr(ip_address) - 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 addresses for the same interface on the same host (most likely containing only a single address).
gethostbyname(hostname) - Translate a host name to IPv4 address format.
gethostbyname_ex(hostname) - Translate a host name to IPv4 address format, extended interface.
gethostname() - Return a string containing the hostname of the machine where the Python interpreter is currently executing.
getprotobyname(protocolname) - Translate an Internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function.
getservbyname(servicename[, protocolname]) - Translate an Internet service name and protocol name to a port number for that service.
getservbyport(port[, protocolname]) - Translate an Internet port number and protocol name to a service name for that service.
htonl(x) - Convert 32-bit integers from host to network byte order.
htons(x) - Convert 16-bit integers from host to network byte order.
inet_aton(ip_string) - Convert an IPv4 address from dotted-quad string format (for example, '123.
inet_ntoa(packed_ip) - Convert a 32-bit packed IPv4 address (a string four characters in length) to its standard dotted-quad string representation (for example, '123.
inet_ntop(address_family, packed_ip) - Convert a packed IP address (a string of some number of characters) to its standard, family-specific string representation (for example, '7.
inet_pton(address_family, ip_string) - Convert an IP address from its family-specific string format to a packed, binary format.
ntohl(x) - Convert 32-bit integers from network to host byte order.
ntohs(x) - Convert 16-bit integers from network to host byte order.
setdefaulttimeout(timeout) - Set the default timeout in floating seconds for new socket objects.
socket([family[, type[, proto]]]) - Create a new socket using the given address family, socket type and protocol number.
socketpair([family[, type[, proto]]]) - Build a pair of connected socket objects using the given address family, socket type, and protocol number.
ssl(sock[, keyfile, certfile]) - Initiate a SSL connection over the socket sock.