UDP stands for User Datagram Protocol. As the name suggests, data is sent out as a complete message (or datagram) in contrast to stream socket where message boundaries are not preserved.
The User Datagram Protocol (UDP) sits at the same level as the Transmission Control Protocol (TCP). However, it is a connection-less protocol as against TCP which is a connection oriented protocol. In the current article, we will examine a UDP socket connection and notice how it differs from a TCP stream socket connection.
FIG Courtesy: Linux Programming Interface, Michael Kerrisk
As can be seen from the diagrammatic representation above, the UDP connection does not involve a listen/accept or connect steps for the server and client as is performed for a TCP socket connection. This is because UDP is a connectionless protocol and does not require a connection to be setup.
A connect API can be used in a UDP socket connection and we will see it’s usage later on for a connected UDP socket.
In the next article we will look at a UDP server/client connection example and analyze the code for the same
Pingback: Analysing the Stream Socket connection | Hitch Hiker's Guide to Learning
Pingback: UDP Server/client example | Hitch Hiker's Guide to Learning
Pingback: Unix Domain UDP Socket Connection Example | Hitch Hiker's Guide to Learning