290 likes | 542 Views
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.
E N D
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 Port Protocol Use 21 FTP File transfer 23 Remote login Telnet E-mail 25 SMTP 69 Trivial File Transfer Protocol TFTP Finger Lookup info about a user 79 80 World Wide Web HTTP POP-3 110 Remote e-mail access USENET news 119 NNTP Some assigned ports.
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 Add Hdr 4B pad Sources # Coding Type The RTP header.
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 6-31 (a) TCP connection establishment in the normal case. (b) Call collision.
TCP Connection Management Modeling Client starts TCP Wait 30s CLOSED Send SYN TIME_WAIT SYN_SENT Receive FIN, Send ACK Receive SYN & ACK Send ACK FIN_WAIT_2 ESTABLISHED Send FIN Receive ACK FIN_WAIT_1
TCP Connection Management Modeling Server application creates LISTEN socket Receive ACK CLOSED LAST_ACK LISTEN Send FIN Receive SYN Send SYN & ACK CLOSE_WAIT SYN_RCVD Receive ACK Receive FIN Send ACK ESTABLISHED
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.