UDP (User Datagram Protocol) is an optional communications protocol to Transmission Control Protocol used mostly for establishing low-latency and loss tolerating connections between applications on the Internet. The IP address is working with TCP and UDP and some time referred to as TCP/IP and UDP/IP. Both TCP and UDP send short packets of data, called datagram.
UDP(User Datagram Protocol) Low Overhead vs Reliability
UDP(User Datagram Protocol) is a protocol that provides the basic transport layer functions. It sends the packets, with lower bandwidth overhead and latency than TCP. UDP is not a connection-oriented protocol so it does not offer the sophisticated retransmission, flow control and sequencing mechanism for lost and out of order packets. So UDP is not providing a reliability like TCP. But this does not mean that application that uses UDP are forever unreliable and substandard. It only means that these functions are not provided by the transport layer protocol and must be implemented in a different place if required.
Because of low overhead, UDP is the best protocol for network applications in which apparent latency is critical such as gaming, voice and video communications, which can bear some data loss without badly disturbing apparent quality. Like TCP, UDP does not set up a connection before sending data, it just starts sending data when required.
UDP Datagram reassemble
UDP datagram is arriving at the destination using different routes, and these datagrams arrive in the wrong order. The UDP does not follow sequence numbers just like TCP. It has no mechanism to reorder the datagram into their transmission order. So, the UDP reassembles the data in the exact order. If the sequence is important to the application; the application should identify the right sequence number and decide how the data should be processed.
UDP(User Datagram Protocol) Server Processes and Requests
UDP-based server applications assign well-known or registered port numbers just like TCP When these applications and processes are running on a server; they accept the data matched with the assigned port number. When UDP receives a datagram destined for one of these ports; it forwards the application data to the proper application based on its port number.
UDP(User Datagram Protocol) Client Processes
The client application will ask a server process to start communication between the server and the client. The UDP client process selects a port number from the range of port numbers randomly. The destination port on the server is generally the well-known or registered port number assigned to the server process. Once the client selects the source and destination ports, the header of all datagram uses this selected pair of ports. For returning the data from the server to the client the destination and source port; are reserved for the datagram header.