This chapter and the following chapters describe the use of sockets, as follows:
- This chapter provides a general introduction to the sockets API. The following chapters assume an understanding of the general concepts presented here. We don’t present any example code in this chapter. Code examples in the Unix and Internet domains are presented in the following chapters.
- Chapter 57 describes Unix domain sockets, which allow communication between applications on the same host system.
- Chapter 58 introduces various computer networking concepts and describes key features of the TCP/IP networking protocols. It provides background needed for the next chapters.
- Chapter 59 describes Internet domain sockets, which allow applications on different hosts to communicate via a TCP/IP network.
- Chapter 60 discusses the design of servers that use sockets.
- Chapter 61 covers a range of advanced topics, including additional features for socket I/O, a more detailed look at TCP (the protocol used for Internet domain stream sockets), and the use of socket options to retrieve and modify various attributes of sockets.
56 Sockets: Introduction
56.2 Creating a Socket: socket()
56.3 Binding a Socket to an Address: bind()
56.4 Generic Socket Address Structures: struct sockaddr
56.5 Stream Sockets
56.5.1 Listening for Incoming Connections: listen()
56.5.2 Accepting a Connection: accept()
56.5.3 Connecting to a Peer Socket: connect()
56.5.4 I/O on Stream Sockets
56.5.5 Connection Termination: close()
56.6 Datagram Sockets
56.6.1 Exchanging Datagrams: recvfrom() and sendto()
56.6.2 Using connect() with Datagram Sockets