Skip to Content
Perl To Python Migration
book

Perl To Python Migration

by Martin C. Brown
November 2001
Beginner
320 pages
5h 53m
English
Pearson Business
Content preview from Perl To Python Migration

OBTAINING NETWORKING INFORMATION

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.

Table 12.3. Perl and Python network information functions
Perl function Python equivalent
gethostbyname(hostname) (scalar context) gethostbyname(hostname)
gethostbyname (hostname) (list context) gethostbyname_ex(hostname) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl in a Nutshell

Perl in a Nutshell

Nathan Patwardhan, Ellen Siever, Stephen Spainhour
Perl by Example

Perl by Example

Ellie Quigley
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 0201734885Purchase book