The user Datagram Protocol is very simple protocol. It adds little to the basic functionality of IP. Like IP, it is an unreliable, connectionless protocol. You need to establish a connection with a host before exchanging data with it using UDP, and there is no mechanism for ensuring that data sent is received.
A unit of data send using UDP is called a Datagram. UDP adds four 16-bit header fields to whatever data is sent. These fields are: a length field, a check-sum field, and source and destination numbers. “Port number”, in this context, represents a software port, not a hardware port. The concept of port number is common to both UDP and TCP. The port number identify which protocol module sent the data.
Most protocols have standard ports that are generally used for this. For example, the Telnet protocol generally used port 23. The simple mail transfer. Protocol (SMTP) uses port 25. The use of standard port numbers makes it possible for clients to communicate with a server without first having to establish which port to use.
The port number and the protocol field in the OP header duplicate each other to some extent, though the protocol field is not available to the higher-level protocols. IP uses the protocol field to determine whether data should be passed to the UDP or TCP module.