Академический Документы
Профессиональный Документы
Культура Документы
LECTURE 8
• I. Process-to-Process Delivery
Transport layer protocols
• II. UDP (User Datagram Protocol)
• III. TCP (Transmission Control Protocol)
• IV. SCTP (Stream Control Transport Protocol)
1 2
To Form
Request
Reply
Form To
9 10
13 14
Example 23.1
In UNIX, the well-known ports are stored in a file called
/etc/services. Each line in this file gives the name of the
server and the well-known port number. We can use the
grep utility to extract the line corresponding to the desired
application. The following shows the port for FTP. Note
that FTP can use port 21 with either UDP or TCP.
19 20
Example 23.1 (continued) Figure 23.9 User datagram format
SNMP uses two port numbers (161 and 162), each for a
different purpose, as we will see in Chapter 28.
UDP length
= IP length – IP header’s length
21 22
23 24
Example 23.2 Figure 23.11 Checksum calculation of a simple UDP user datagram
25 26
23-3 TCP
UDP Applications
• Simple request-response communication TCP is a connection-oriented protocol; it creates a
—Little concern on flow and error control virtual connection between two TCPs to send data. In
• Process with internal flow and error control addition, TCP uses flow and error control mechanisms
mechanisms at the transport level.
• Multicasting (one-to-many communication)
—Multicasting is only supported by UDP Topics discussed in this section:
TCP Services
• Management process such as SNMP
TCP Features
• Routing protocol such as Routing Information Segment
Protocol (RIP) A TCP Connection
Flow Control
Error Control
31 32
Table 23.2 Well-known ports used by TCP
• Full-Duplex communication
—Data flows in both directions at the same time
• Connection-oriented with setup and tear-down
• Reliable service via acknowledgement mechanism
33 34
Figure 23.13 Stream delivery Figure 23.14 Sending and receiving buffers
41 42
• Flow control
—Receiver can control the amount of data that are to
be sent by the sender
• Error control
—Error in data segment is detected by checksum
—Retransmission of error segment is used to provide
reliable service
• Congestion control
—Amount of data that can be transmitted also depends
on level of congestion in the network
45 46
47 48
TCP Header (2) TCP Connection
• Header length defines the length of TCP header • TCP is connection-oriented
in a unit of 4-bytes • TCP uses the service of IP (connectionless) but
— 4 bits allow up to 60 bytes (15 x 4) bytes for header
additionally
• Window size indicates the number of bytes —Retransmit a lost or corrupted segment
which this host is willing to accept
—Hold any out-of-order segment until the missing
—Beginning with the one indicated in the
acknowledgment field segment arrives
Figure 23.19
TCP Data Transfer Data transfer
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
• rwnd = Receiver window receive only 4000 bytes of data before overflowing its
— Value advertised by the opposite end in a segment containing
acknowledgement
buffer. Host B advertises this value in its next segment to
— Reflects the number of bytes that the receiver can accept before A.
its buffer overflow and data are discarded
• cwnd = Congestion window
— Will be discussed in the next Chapter
63 64
Example 23.5 Example 23.6
What is the size of the window for host A if the value of Figure 23.23 shows an unrealistic example of a sliding window. The
rwnd is 3000 bytes and the value of cwnd is 3500 bytes? sender has sent bytes up to 202. We assume that cwnd is 20 (in
reality this value is thousands of bytes). The receiver has sent an
acknowledgment number of 200 with an rwnd of 9 bytes (in reality
Solution this value is thousands of bytes). The size of the sender window is
The size of the window is the smaller of rwnd and cwnd, the minimum of rwnd and cwnd, or 9 bytes. Bytes 200 to 202 are
which is 3000 bytes. sent, but not acknowledged. Bytes 203 to 208 can be sent without
worrying about acknowledgment. Bytes 209 and above cannot be
sent.
65 66
Figure 23.24
Normal operation
TCP Retransmission ACK may be delayed by 500 ms to
wait for any additional segments
• Retransmission after Retransmission Time-Out (RTO)
— TCP maintains one RTO timer for all unacknowledged segments
— When the timer matures, the earliest outstanding segment is
retransmitted
— RTO is dynamically calculated from Round-Trip Time (RTT)
• RTT = Time needed for a segment to reach a destination and for an
ACK to be received
• Retransmission after three duplicated ACK segments
— Allow immediate retransmission before RTO
— Also called fast retransmission
In modern implementations, a retransmission occurs
if the retransmission timer expires or three duplicate
ACK segments have arrived.
No retransmission timer is set for an ACK segment.71 72
TCP Operation with Lost
TCP In-sequence Delivery Segment
• Segment may arrive out-of-order if the previous • Lost and corrupted segments are treated the
segment is same way by the receiver
— Delayed • Receiver stores data in its buffer
— Lost or discarded — But leaves a gap to indicate that there is no continuity
• Out-of-order segment is hold by TCP until the in the data
missing segment arrives — Also immediately send ACK to the sender with the
— Out-of-order segments are not delivered to the next byte that it expects
application layer — Store bytes 801 to 900 but never delivers them to
application until the gap is filled
Data may arrive out of order and be temporarily stored • Third ACK changes according to the updated
by the receiving TCP, but TCP guarantees that no out- status
of-order segment is delivered to the process.
The receiver TCP delivers only ordered data to the process.
73 74
75 76
Figure 23.26 Fast retransmission
TCP Acknowledgement Number
• Acknowledgement (ACK) number confirms the
bytes it has received
• ACK number defines the number of the next
byte that it expects to receive
• ACK number is cumulative
—ACK number = 5643 means that it has received all
bytes from the beginning up to 5642
The value of the acknowledgment field in a
segment defines the number of the next byte a
party expects to receive.
The acknowledgment number is cumulative.
77 78
SCTP Acknowledgement
Figure 23.31 SCTP packet format
91 92
Table 23.5 Chunks
Figure 23.32 General header
99 100
Figure 23.36 Flow control, receiver site Figure 23.37 Flow control, sender site
Figure 23.38 Flow control scenario Figure 23.39 Error control, receiver site