- The transport layer is responsible for process-to-process communication.
- Port Number : the port number defines one of the processes on this particular host
- The lANA (Internet Assigned Number Authority) has divided the port numbers
- three ranges:
- well known,
- registered, and
- dynamic (or private)
- Well-known ports: The ports ranging from 0 to 1023 are assigned and controlled by lANA. These are the well- known ports.
- Registered ports : The ports ranging from 1024 to 49,151 are not assigned or controlled by lANA. They can only be registered with lANA to prevent duplication.
- Dynamic ports : The ports ranging from 49,152 to 65,535 are neither controlled nor registered. They can be used by any process. These are the ephemeral ports.
- three ranges:
- The combination of an IP address and a port number is called a socket
- The client socket address defines the client process uniquely just as the server socket address defines the server process uniquely address.
Connectionless Versus Connection-Oriented Service:-
- A transport layer protocol can either be connectionless or connection-oriented.
1. Connectionless Service
- In a connectionless service, the packets are sent from one party to another with no need for connection establishment or connection
- The packets are not numbered;
- They may be delayed or lost or may arrive out of sequence.
- There is no acknowledgment either.
- UDP, is connectionless.
2. Connection Oriented Service
- a connection is first established between the sender and the
- Data are transferred. At the end, the connection is released.
- TCP and SCTP are connection-oriented protocols.
Reliable Versus Unreliable
- The transport layer service can be reliable or unreliable
- by implementing flow and error control at the transport layer.
- This means a slower and more complex service.
- uses its own flow and error control mechanism or it needs fast service or the nature of the service.
- does not demand flow and error control
- USER DATAGRAM PROTOCOL (UDP)
- a connectionless, unreliable transport protocol
- It does not add anything to the services of IP except to provide process-to-process communication instead of host-to-host communication.
- Also, it performs very limited error checking.
- USER DATAGRAM PROTOCOL (UDP)
Well-Known Ports for UDP
- UDP packets, called user datagrams, have a fixed-size header of 8 bytes.
Source port number :
- 16 bits long range from 0 to
- If the source host is the client – an ephemeral port number requested by the process and chosen by the UDP software running on the source host.
- If the source host is the server the port number, in most cases, is a well-known port number.65,535.
Destination port number :
- 16 bits long.
- If the destination host is the server, the port number, is a well-known port number.
- If the destination host is the client the port number, is an ephemeral port number.
- 16-bit field – defines the total length of the user datagram, header plus data.
- The 16 bits can define a total length of 0 to 65,535 bytes
UDP length = IP length – IP header’s length
- This field is used to detect errors over the entire user datagram (header plus data).
1. Connectionless Services
- Each user datagram sent by UDP is an independent datagram
- The user datagrams are not numbered.
- Also, there is no connection establishment and no connection termination
2.Flow and Error Control
- There is no error control mechanism in UDP except for the checksum
3.Encapsulation and Decapsulation
- UDP protocol encapsulates and decapsulates messages in an IP datagram.
- In UDP, queues are associated with ports
Use of UDP
The following lists some uses of the UDP protocol:
- UDP is suitable for a process that requires simple request-response communication with little concern for flow and error control. It is not usually used for a process such as FrP that needs to send bulk data.
- UDP is suitable for a process with internal flow and error control mechanisms. For example, the Trivial File Transfer Protocol (TFTP) process includes flow and error control. It can easily use UDP.
- UDP is a suitable transport protocol for multicasting. Multicasting capability is embedded in the UDP software but not in the TCP software.
- UDP is used for management processes such as SNMP.
- UDP is used for some route updating protocols such as Routing Information Protocol (RIP)
- TCP, like UDP, uses port
- Unlike UDP, TCP is a connection oriented protocol; it creates a virtual connection between two TCPs to send data.
- In addition, TCP uses flow and error control mechanisms at the transport level.
- TCP is called a connection-oriented, reliable transport protocol.
- It adds connection-oriented and reliability features to the services of IP.numbers.
- Like UDP, TCP provides process-to-process communication using port numbers.
Stream Delivery Service
- TCP, unlike UDP, is a stream-oriented protocol.
- TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet.
- TCP needs buffers for storage
- Each TCP has a sending and receiving buffer, and segments move in both directions.
- The two TCPs establish a connection between them.
- Data are exchanged in both directions.
- The connection is terminated.
- TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and sound arrival of data.
- The bytes of data being transferred in each connection are numbered by TCP.
- The numbering starts with a randomly generated number.
- The numbering system allows TCP to use a byte-oriented flow control
- error control is byte-oriented
- TCP, unlike UDP, takes into account congestion in the network.
- A packet in TCP is called a segment.
- The format of a segment is shown below.
Source port address :
- 16-bit field- defines the port number of the application program in the host that is sending the segment.
Destination port address :
- 16-bit field defines the port number of the application program in the host that is receiving the segment.
Sequence number :
- 32-bit field & the number assigned to the first byte of data contained in this segment. As we said before, TCP is a stream transport protocol.
Acknowledgment number :
- 32-bit field & the byte number that the receiver of the segment is expecting to receive from the other party.
- If the receiver of the segment has successfully received byte number x from the other party, it defines x + I as the acknowledgment number. Acknowledgment and data can be piggybacked together.
Header length :
- 4-bit field indicates the number of 4-byte words in the TCP header.
- The length of the header can be between 20 and 60 bytes.
- 6-bit field reserved for future use.
- defines 6 different control bits or flags as shown in Figure below.
- One or more of these bits can be set at a time.
Window size :
- defines the size of the window, in bytes, 16 bits, i.e maximum size of the window is 65,535 bytes.
- This value is normally referred to as the receiving window (rwnd) and is determined by the receiver.
- The sender must obey the dictation of the receiver in this case.
- bit field contains the checksum.
Urgent pointer :
- l6-bit field, valid only if the urgent flag is set, is used when the segment contains urgent data.
- It defines the number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment.
- There can be up to 40 bytes of optional information in the TCP header.
- We will not discuss these options here; please refer to the reference list for more information.
A TCP Connection –
- TCP is connection-oriented.
- A connection-oriented transport protocol establishes a virtual path between the source and destination.
- All the segments belonging to a message are then sent over this virtual path.
- Using a single virtual pathway for the entire message facilitates the acknowledgment process as well as retransmission of damaged or lost frames.
- If a segment is lost or corrupted, it is retransmitted.
- Unlike TCP, IP is unaware of this retransmission.
- If a segment arrives out of order, TCP holds it until the missing segments arrive; IP is unaware of this reordering.
- In TCP, connection-oriented transmission requires three phases:
- Connection establishment,
- Data transfer, and
- Connection termination.