|
|
A network consists of multiple computers (also called ``hosts'') connected to each other in a way that allows one host to communicate with any of the other hosts on the network. Furthermore, a network may be connected to other networks, either directly or indirectly. Note that a single host can be directly connected to more than one network.
The transport provider running on a given host must be able to identify both that host and the network to which the host is attached. Generically, this information is referred to as the ``network address'' and the ``host id.'' Because each kind of transport provider has its own scheme for what network addresses and host ids look like, refer to the chapter in this Guide that discusses the specific transport provider you will be using in your application for more information.
Being able to identify a particular host and the network to which it is attached is not enough, however. With a multi-tasking operating system such as UNIX, many processes (whether clients, servers, or both) can be running on the same host simultaneously. As a result, the transport provider must be able to uniquely identify every process on the host that communicates with the transport provider. Each kind of transport provider defines its own identifier (the ``local process id'') for this purpose. Refer to the chapter that talks specifically about the transport provider you will be using for more information.
Once a process (whether client or server) has opened a transport endpoint with a specific transport provider, it needs to establish the network address and host id of the machine it is running on, as well as the local process id by which it will be known. A process associates this information with the transport endpoint by calling the t_bind function.
The process can either select the network address, host id, and local process id to be used, or it can allow the transport provider to select them. Even if the process makes the selection, the transport provider can override it. In either case, the process can, if it wants, find out the network address, host id, and local process id selected by the transport provider. It does this by providing the appropriate argument to t_bind.
Usually, servers specify their local process id and clients do not. This is because clients are written to contact a particular server using the predetermined local process id of that server. It is crucial, therefore, that the server use the predetermined local process id and no other. On the other hand, when a client connects to a server, the local process id of the client is passed to the server when the server accepts the connection. The actual value of the local process id being used by the client is of no importance.