A transport provider typically offers two different modes of service: ``connection-oriented'' and ``connectionless.''
With ``connection-oriented'' service, a client and a server establish a communication path over which they send and receive data. This kind of service is useful when a client and server expect to have an extended dialogue with each other.
One of the characteristics of connection-oriented service is that the communication is sequenced, reliable, and error-free. This means that all data sent by one process is guaranteed to be received by the destination process, that the data arrives exactly in the order it was sent, and that the data arrives without having been altered or corrupted.
A client and a server must cooperate to set up a connection. The server prepares to receive an incoming connection request by calling t_listen. The client then calls t_connect to request a connection with that server. Finally, the server accepts the connection request by calling t_accept.
With ``connectionless'' service, the client and server exchange individual messages. This is often appropriate when the service or computation provided by the server requires very little interaction between the server and the client.
For example, a time-of-day server can compute the current time of day and return the result in a single message. Using the connectionless service, the client and server avoid the extra processing performed by the transport provider at both the server and the client to set up a connection.
When no connection is established, each message sent must contain the address of the destination network, host id, and local process id. Similarly, each message received must contain the address of the network, the host id, and local process id of the process that sent the message.
In a typical scenario, the client and server begin by calling t_open and t_bind. The client then calls t_alloc to allocate space for the message to be sent, fills in the data area with the message, then sends the message to the server by calling t_sndudata (send unit data). Meanwhile, the server awaits the incoming message by calling t_rcvudata (receive unit data). After the client sends its message, it calls t_rcvudata and waits for the server to respond. When the client's message arrives at the server, the server's call to t_rcvudata completes. The server can then examine the message, perform whatever computation it was designed to do, and send its reply by first calling t_alloc, filling the data area with its reply, then sending it off with t_sndudata.
The client and server continue to exchange messages this way until they are finished.
Unlike the connection-oriented service, a connectionless service does not guarantee delivery of messages, does not ensure that messages arrive at their destination in the same order in which they were sent, and does not ensure that data arrives error-free.