Network Names and Services

The example in the last section used the remote host's dotted-quad IP address and numeric port and protocol numbers to construct the socket. Usually, however, you'll want to use symbolic names instead of numbers. Not only does this make it easier to write the program, but it makes it easier for end users to use it, allowing them to enter the host address as wuarchive.wustl.edu rather than 128.252.120.8.

The domain name system (DNS) is an Internet-wide database that translates hostnames into dotted IP addresses and back again. Various local database services translate from service names into numbers. This section introduces the functions that allow you to translate names into numbers, and vice versa.

Translating Hostnames ...

Get Network Programming with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.