Summary

A socket is an endpoint for communications. In Perl, a socket looks and acts much like a filehandle. There are several species of socket distinguished by their address families, type, and communications protocol. The most frequently used sockets belong to the AF_INET (Internet) address families, and use either the stream-oriented TCP protocol or the datagram-oriented UDP protocol.

UNIX-domain sockets use addresses based on local filenames, whereas Internet-domain sockets use a combination of IP address and port number. Addresses must be packed into binary form before passing them to any of Perl's built-in network functions.

Perl provides a complete set of functions for interconverting the numeric and symbolic forms of host addresses, ...

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.