The Linux Programming Interface

(nextflipdebug5) #1

Chapter 59: Sockets: Internet Domains


Having looked at generic sockets concepts and the TCP/IP protocol suite in previous
chapters, we are now ready in this chapter to look at programming with sockets in
the IPv4 (AF_INET) and IPv6 (AF_INET6) domains.
As noted in Chapter 58, Internet domain socket addresses consist of an IP address
and a port number. Although computers use binary representations of IP
addresses and port numbers, humans are much better at dealing with names than with
numbers. Therefore, we describe the techniques used to identify host computers
and ports using names. We also examine the use of library functions to obtain the
IP address(es) for a particular hostname and the port number that corresponds to
a particular service name. Our discussion of hostnames includes a description of
the Domain Name System (DNS), which implements a distributed database that
maps hostnames to IP addresses and vice versa.

59.1 Internet Domain Sockets


Internet domain stream sockets are implemented on top of TCP. They provide a
reliable, bidirectional, byte-stream communication channel.
Free download pdf