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, protocols, and services. Using the symbolic names makes programs easier to use and maintain, and promotes portability. We closed this chapter with a brief list of the utilities that are commonly used for detecting and diagnosing network configuration problems. |