gtpc1m3dTransmission Control Protocol/Internet Protocol

Function Calls Used in a Sample UDP Session

User Datagram Protocol (UDP) is not clearly distinguished by server and client roles. The distinction is between connected and unconnected sockets. UDP uses an unconnected socket to communicate with any host. Data is sent in independent packets. Once the data has been accepted by the UDP interface, the arrival and integrity of the data is not guaranteed. Unlike connected Transmission Control Protocol (TCP) sockets, connectionless sockets can communicate with any server.

Figure 25 shows a general sequence of function calls used in a connectionless socket session and indicates the calls issued by the server and by the client.

The following steps correspond to the numbers in Figure 25:

  1. The server and client both create a socket s.
  2. The server uses the bind call to associate a local address to the socket.

    The client can issue an optional bind call to a local address.

  3. The sendto and recvfrom calls between the client and server continue until all the data has been transferred.
  4. Both the server and client end the session using the close call.

Figure 25. Sample Socket Session Using UDP Protocol