Udp-Tcp
Udp-Tcp
UDP, TCP
23.5
Figure 23.2 Port numbers
Figure 23.3 IP addresses versus port numbers
Figure 23.4 IANA (Internet assigned number Authority) ranges
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.
Figure 23.5 Socket address
Connectionless Service:
In a connectionless service, the packets are sent from one party to another with
no need for connection establishment or connection release.
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.
Connection-Oriented Service:
In a connection-oriented service, a connection is first established between the
sender and the receiver.
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.
If the application layer program needs reliability, we use a reliable
transport layer protocol by implementing flow and error control at the
transport layer.
This means a slower and more complex service.
On the other hand, if the application program does not need reliability
because it 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
(real-time applications), then an unreliable protocol can be used.
In the Internet, there are three common different transport layer protocols,
as we have already mentioned.
UDP is connectionless and unreliable;
TCP and SCTP are connection-oriented and reliable.
Figure 23.7 Error control
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite
23-2 USER DATAGRAM PROTOCOL (UDP)
UDP length
= IP length – IP header’s length
Figure 23.10 Pseudoheader for checksum calculation
Figure 23.12 Queues in UDP
23-3 TCP
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to
A.
Example 23.5
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
Example 23.6
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note
mechanisms.
TCP uses a congestion window and a congestion policy that avoid congestion
Congestion Window
51 Congestion Policy
TCP Congestion Control
Slow Start: Exponential Increase
Congestion Avoidance: Additive
Increase
Congestion Detection: Multiplicative
Decrease
Figure 34 Slow start, exponential increase
1
cwnd
RTT
2
cwnd
RTT
4
cwnd
RTT
8
cwnd
Note
window
congestion is detected.
Congestion Detection:
Multiplicative Decrease
If congestion occurs, size of
congestion window must be
decreased.
If a time-out occurs (Strong possibility)
Set the value of the threshold to one half of
the current window size.
It sets the cwnd to the size of one segment.
Starts slow start.
Congestion Detection:
Multiplicative Decrease
If Three ACK are received (Weak
possibility)
Set the value of the threshold to one half of
the current window size.
It sets the cwnd to the value of threshold.
Starts congestion avoidance.
Figure 37 Congestion example