November 2001
Beginner
320 pages
5h 53m
English
The socket module is also responsible for talking with the host operating system to determine information such as the protocol and service lists and for communicating with the host domain name resolver to resolve hostnames into their IP addresses.
The information returned by most of the Python equivalent matches the information returned by the Perl functions when called in scalar context. However, all IP addresses are returned in the form of a string on dotted-quads, rather than the packed format returned by Perl.
| Perl function | Python equivalent |
|---|---|
| gethostbyname(hostname) (scalar context) | gethostbyname(hostname) |
| gethostbyname (hostname) (list context) | gethostbyname_ex(hostname) ... |