Ch10:UDP
User Datagram Protocol
UDP is connectionless unreliable transport protocol. It does not add anything to the service of IP except for providing communication instead of Host-to-Host communication. A process is a running application program. Identified by the “port” number.
UDP is a simple protocol, does not provide flow control mechanism and there is no acknowledgment for received UDP datagram.
For communication we must define
- local host
- local process
- remote host
- remote process
The client-server paradigm: A process on the local host called a needs services from a process usually on the remote-host called
The local host and the remote host are defined using IP addresses. To define the processes we need Identifiers called
The client program defines itself with a port number called .(临时端口) The server use universal port number an they are called .(常用端口)
The destination IP address defines the host among the different hosts in the world. After the host has been selected the port number defines one of the processes on this particular host.
The ports ranging from 0-1023 are assigned and controlled by ICANN internet corporation for assigned names and numbers.
The ports ranging from 1024-49151 are not assigned or controlled by ICANN. They can only be registered with ICANN to prevent duplication.
The ports ranging from 49152-65535 are neither controlled nor registered. They can be used as temporary or private port numbers.
Socked address = IP address + Port number
The combination of an IP address and a port number is called a The client address defines the client process uniquely just as the server socket address defines the server process uniquely.
UDP datagram format
The UDP datagram have a fixed-size header of 8 bytes.
- If the source host is the client, the port number is an ephemeral port number If the source host is the server, the port number is a well-known port number.
- Same story as the source port number.
- This is a 16-bit field that defines the total length of the UDP datagram.
- Error detection.
UDP provides a connectionless service. The user datagram are not numbered. There is no connection establishment and no connection termination.
The queues opened by the client are identified by ephemeral port numbers. The queues function as long as the process is running. When the process terminates the queues are destroyed.
At the server side the mechanism of creating queues is different. A server asks for incoming and outgoing queues using its well-known port. When it starts running the queues remain open as long as the server is running, even the process terminated.
The UDP package involves the following components:
- Control-block table
- Control-block module
- Queues
- Input module
- Output module
keeps track of the open ports each entry in this table has four fields.
- State: “Free” or “In-use”
- Process ID
- Port number
- Queue number
The is responsible for the management of the control-block table.When a process starts, it asks for a port number from the operating system. The process passes the process id, and the port number to the control-block module to create an entry in the table for the process.
The receives a user datagram from the IP layer. It searches the control-block table to find an entry having the same port number as this user datagram. If the entry is found, the module uses information in the entry to enqueue the data.
Comments