The socket module properties in Python

Source: Internet
Author: User

Data properties Describe
Af_unix,af_inet,af_inet6 Python-Supported socket families
Sock_stream,sock_dgram Socket type (tcp= stream, udp= datagram)
Has_ipv6 Flag variable indicating whether IPV6 is supported
/tbody>
exception description
error
herror host and address-related errors
address-related error
timeout
Function Describe
Socket () Create a Socket object
Socketpair () Create a pair of sockets
FROMFD () Create a socket object with an open file descriptor
Data properties Describe
SSL () Initializes a secure Sockets layer on the socket. Do not verify the certificate
Getaddrinfo () Get address information
Getfqdn () Returns the name of the full domain
GetHostName () Get the current host name
GetHostByName () The corresponding IP address is obtained by host name
GETHOSTBYNAME_EX () Extended version of GetHostByName (), returns host name, all aliases and IP address list of host
GETHOSTBYADDR () Get DNS information from IP address, return a 3-tuple similar to GETHOSTBYNAME_EX ()
Getservbyname ()/getservbyport () Get the corresponding port number or vice versa by the service name
getprotobyname () by protocol name (e.g. ' TCP ' ) to get the corresponding number
Data properties Describe
Ntohl ()/ntohs () Convert an integer from network byte order to host byte order
Htonl ()/htons () Convert an integer from host byte order to network byte order
Inet_aton ()/inet_ntoa () Convert IP address to 32-bit integer, and inverse function
Inet_pton ()/inet_ntop () Convert IP address into binary format and inverse function
Getdefaulttimeout ()/setdefaulttimeout () Get/Set Default socket time-out


The socket module properties in Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.