Upload
reynard-garrett
View
220
Download
4
Embed Size (px)
Citation preview
The Transport Layer
The Transport Service
• Services provided to the application layer by using the network layer service
• Transport header of a segment exchanged between two users is not read by routers and packet switches.
Transport Service
The nesting of TPDUs, packets, and frames.
Berkeley Sockets
The socket primitives for TCP.
Elements of Transport Protocols
• Addressing
• Connection Establishment
• Connection Release
• Flow and Congestion Control
• Buffering
• Multiplexing, Demultiplexing
UDP and TCP
• User Datagram Protocol (UDP) provides only of multiplexing/ demultiplexing of data exchange between different applications. It is connectionless service.
• Transmission Control Protocol (TCP) provides a reliable service to the applications. It is connection oriented service.
UDP and TCP Addressing
• Whenever a UDP socket is created, an available or a specified port number is assigned to it.
• The UDP socket is determined only by the destination port number. The source port number serves as a return address.
• The TCP server application has a “welcoming socket” for accepting connection requests. When a client socket is created, a port number is assigned to it and a connection is requested.
• TCP server socket is determined by the source IP address, source port number, destination IP address, destination port number.
The TCP Service Model
Some assigned ports.
Port Protocol Use21 FTP File transfer23 Telnet Remote login25 SMTP E-mail69 TFTP Trivial File Transfer Protocol79 Finger Lookup info about a user80 HTTP World Wide Web
110 POP-3 Remote e-mail access119 NNTP USENET news
UDP Segment Header
The UDP header.
Real-Time Transport Protocol (RTP)
(a) The position of RTP in the protocol stack. (b) Packet nesting.
RTP Header
The RTP header.
4B pad Add Hdr
Sources # Coding Type
Transport Control Protocol (TCP)
• TCP Connection Establishment• TCP Connection Release• TCP Connection Management Modeling• TCP Transmission Policy• TCP Flow and Congestion Control• TCP Timer Management
The TCP Segment Header
TCP Header.
The TCP Segment Header
The pseudoheader included in the TCP checksum.
TCP Connection Establishment
(a) TCP connection establishment in the normal case.(b) Call collision.
6-31
TCP Connection Management Modeling
CLOSED
ESTABLISHEDFIN_WAIT_2
TIME_WAITSYN_SENT
FIN_WAIT_1
Client starts TCP
Send SYN
Receive SYN & ACKSend ACK
Send FIN
Receive ACK
Receive FIN,Send ACK
Wait 30s
TCP Connection Management Modeling
CLOSED
SYN_RCVDCLOSE_WAIT
LAST_ACKLISTEN
ESTABLISHED
Server application creates LISTEN socket
Receive SYN Send SYN & ACK
Receive ACK
Receive FINSend ACK
Send FIN
Receive ACK
TCP Mechanisms
• TCP is a combination of Go Back N and Selective Repeat protocols.
• Receiver sends ack with the sequence number of the last received byte. It is cumulative, meaning that it acks all previously received segments.
• Sender keeps only the info about the first unack-ed segment, and retransmits the previous segment when it the timer expires or when it receives 3 identical ACKs.
• Receiver has buffer and may receive segments out of order.
TCP ACK Generation
• When a segment arrives in order and all previous data are acked, receiver waits for 500ms and sends ACK.
• When a segment arrives in order and there is one segment waiting for ACK, the ACK is sent immediately.
• When a segment arrives out of order, immediately send ACK with the next expected sequence number.
• Arrival of segment that fills the gap. Immediately send ACK.
Flow Control
• Processor of the receiver often handles multiple applications and tasks, so the speed of handling of a specific application is variable and limited.
• Receiver sends the receive window with each ACK, that specifies the empty space in the receiver buffer.
• Sender makes sure that the difference between the last byte sent and the last byte acked is smaller than the receive window, so that the receive buffer is not overflowed.
TCP Transmission Policy
Window management in TCP.
Congestion Control
• When a timeout period expires, sender retransmits a packet, and timer is triggered again but it is set to twice the previous value. When a new segment is generated, or when ACK is received, the timer is set to the estimated timeout period.
• Window size (w) is initially set to 0 and threshold size (t) is set to some large value.
• When w<t, w grows exponentially fast (incremented by one whenever it receives ACK)-slow-start phase.
• When w>t, w grows linearly (roughly by 1 once per RTT).• When triple ACK occcurs, the t=w/2, w=t.• If timeout happens, t=w/2, w=1.
Congestion Control
• Sender must ensure that:
Last byte sent – Last byte ACKed ≤
min{Congestion Window, Received Window}
TCP Congestion Control
An example of the Internet congestion algorithm.
TCP Timer Management
(a) Probability density of ACK arrival times in the data link layer.
(b) Probability density of ACK arrival times for TCP.
Timeout Calculation
• Timeout is
Timeout=2RTT
where RTT is a round-trip time:
RTT=αRTT+(1-α)M, α=7/8• Alternatively timeout is:
Timeout = RTT+4xD
where D is estimated variance:
D=αD+(1-α)|RTT-M|
TCP Versions
• TCP Reno• TCP Vegas is modification of Reno• TCP Tahoe is older version
Wireless TCP and UDP
Splitting a TCP connection into two connections.