As noted above, most applications consist of pairs of communicating processes,with the two processes in each pair sending messages to each other. Any messagesent from one process to another must go through the underlying network. A processsends messages into, and receives messages from, the network through a softwareinterface called a socket. Let’s consider an analogy to help us understand processesand sockets. A process is analogous to a house and its socket is analogous to its door.When a process wants to send a message to another process on another host, itshoves the message out its door (socket). This sending process assumes that there isa transportation infrastructure on the other side of its door that will transport themessage to the door of the destination process. Once the message arrives at the destination host, the message passes through the receiving process’s door (socket), andthe receiving process then acts on the messageFigure 2.3 illustrates socket communication between two processes that communicate over the Internet. (Figure 2.3 assumes that the underlying transport protocol used by the processes is the Internet’s TCP protocol.) As shown in thisfigure, a socket is the interface between the application layer and the transportlayer within a host. It is also referred to as the Application Programming Interface (API) between the application and the network, since the socket is the programming interface with which network applications are built. The applicationdeveloper has control of everything on the application-layer side of the socket but
has little control of the transport-layer side of the socket. The only control that the
application developer has on the transport-layer side is (1) the choice of transport
protocol and (2) perhaps the ability to fix a few transport-layer parameters such as
maximum buffer and maximum segment sizes (to be covered in Chapter 3). Once
the application developer chooses a transport protocol (if a choice is available),
đang được dịch, vui lòng đợi..
