User Datagram Protocol (UDP)
In the TCP/IP protocol suite, the User Datagram Protocol (or UDP) provides the primary mechanism that application programs use to send datagrams to other application programs.
UDP provides protocol ports used to distinguish among multiple programs executing on a single machine. In addition to the data sent, each UDP message contains both a destination port number and a source port number.
The destination UDP software delivers the message to recipient and recipient sends the reply.
- All multiplexing between UDP software and application programs occur through the port mechanism.
- Each application program must negotiate with the operating system to obtain a protocol port and an associated port number before it can send a UDP datagram.
- Once the port has been assigned any datagram the application program sends through the port will have that port number in its UDP SOURCE PORT field.
- While processing input, UDP accepts incoming datagrams from the IP software and demultiplexes based on the UDP destination port...
^ ^ ^
| | |
| | |
| | |
| | |
Based On Port
| UDP Datagram arrives
[/code]*Example of demultiplexing one layer above IP. UDP uses the UDP destination port number to select an appropriate destination port for incoming datagrams.
Think of the UDP port as a queue. The operating system creates an internal queue. It can specify and change queue size.
The UDP receives a datagram and then checks to see that the destination port number matches one of the ports currently in use. If not, it sends an ICMP port unreachable error message and discards the datagram.
If a match is found, UDP enqueues the new datagram at the port where an application program can access it.
NOTE: An error will occur if the port is full, and UDP will discard the incoming datagram.
Reserved And Available UDP Port Numbers (2 Types)
How does computer A obtain a file from computer B?... it needs to know what port the file transfer program on computer B uses.
Universal Assignment uses one Central Authority and assigns port numbers and then publishes what are known as "Well-known ports". All software is then built according to the list.
Port assignments that use dynamic binding have ports that are not globally known.
- The network software assigns the port.
- Then a request is sent asking "What port is the file transfer service using.".
- Target machine replies by giving the correct port number to use.