The Connected UDP Socket connection

We all hear that UDP is a connection less protocol. As also seen from the previous examples, it is observed that there is no peer connection established.

But what if we wish to create an UDP socket connection and not a TCP connection between two dedicated endpoints. 

The connect API allows us to achieve the same. In the case of a TCP connection, invoking connect to the server leads to the three way TCP handshake resulting in a port being assigned to the client by the operating system. This allows a TCP socket connection to use APIs such as send/recv as each endpoint is known to the operating system and the operating system can forward the packet appropriately.

In the case of a UDP socket connection, the APIs that we have used till now is recvfrom/sendto APIs- which derives the address of communication from the received packet (or the address to send packet is known to the client).

In the next article, we will see an instance of a connected UDP socket connection.

Connected UDP Socket Connection – setup

 

Comments

  1. Pingback: Analyzing the Unix Domain UDP Socket Code | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *