360 likes | 547 Views
PART V. Transport Layer. Position of transport layer. Transport layer duties. Packetizing: Dividing large messages and adding a header Connection control: Connection-oriented or connectionless delivery Addressing Providing reliability: Flow control and error control
E N D
PART V.Transport Layer Computer Networks
Position of transport layer Computer Networks
Transport layer duties • Packetizing: Dividing large messages and adding a header • Connection control: Connection-oriented or connectionless delivery • Addressing • Providing reliability: Flow control and error control • Congestion control and QoS Computer Networks
Chapter 22. Process-to-Process DeliveryUDP and TCP 22.1 Process-to-Process Delivery 22.2 UDP 22.3 TCP Computer Networks
Types of data deliveries • The transport layer is responsible for process-to-process delivery. • Process (application program ??) Computer Networks
Client-Server Paradigm • Address required for delivery • Transport layer address: port number • Most common process-to-process communication is the client-server paradigm • Operating systems support multiuser and multiprogramming environments. • Local host, local process, remote host, remote process must be defined Addressing Computer Networks
Port numbers • 16 bits between 0 and 65553: ephemeral port number • IANA (Internet Assigned Number Authority) range: well-known ports, registered ports, dynamic ports Computer Networks
IP addresses versus port numbers Computer Networks
Socket address • Process-to-process delivery needs two identifiers, IP address and the port number • Socket address is the combination of an IP address and a port number • A transport-layer protocol needs a pair of socket addresses; the client and server socket address Computer Networks
Multiplexing and demultiplexing • Multiplexing required because of several processes with only one transport-layer protocol Computer Networks
Connection establishment • In the case of connection-oriented service Computer Networks
Connection termination • In the case of connection-oriented service Computer Networks
UDP • UDP is a connectionless, unreliable protocol that has no flow and error control. It uses port numbers to multiplex data from the application layer. • UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used by multimedia applications. • The calculation of checksum and its inclusion in the user datagram are optional Computer Networks
Well-known ports used by UDP Computer Networks
Error control • Error control at the data link layer does not guarantee error control at the transport layer. • UDP: connectionless and unreliable • TCP: connection-oriented and reliable Computer Networks
TCP • Transmission Control Protocol • Stream connection-oriented and reliable transport protocol • It adds connection-oriented and reliability features to the services of IP • Like UDP, TCP uses port numbers as transport-layer addresses • Unlike UDP, TCP is a stream-oriented protocol Computer Networks
Well-known ports used by TCP Computer Networks
Sending and receiving buffers • Buffering handles the disparity between the speed of the producing and consuming processes • One example: to use a circular array of 1-byte locations Computer Networks
TCP segments • IP layer needs to send data in packets not as a stream of byte Computer Networks
Sequence number • The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number. • The value of the sequence number field in a segment defines the number of the first data byte contained in that segment. • 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 • Example: Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data are sent in five segments with the first four segments carrying 1000 bytes and the last segment carrying 2000 bytes? • Solution: Segment 1==> sequence number: 10,010 (range: 10,010 to 11,009) Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009) Segment 3==> sequence number: 12,010 (range: 12,010 to 13,009) Computer Networks
TCP segment format Computer Networks
TCP control field Computer Networks
Three-step connection establishment Computer Networks
Four-step connection termination Computer Networks
States for TCP Computer Networks
State transition diagram • TCP software is implemented as a finite state machine Computer Networks
Sliding windows protocol • A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP’s sliding windows are byte-oriented. • In TCP, the sender window size is totally controlled by the receiver window value (the number of empty locations in the receiver buffer). However, the actual window size can be smaller if there is congestion in the network. • The source does not have to send a full window’s worth of data. • The size of the window can be increased or decreased by the destination. • The destination can send an acknowledgment at any time. Computer Networks
Sender buffer Receive window Sender buffer and receive window Computer Networks
Sender buffer and sender window Sliding the sender window Computer Networks
Sliding the sender window Computer Networks
Expanding the sender window Shrinking the sender window Computer Networks
Silly window syndrome • When either the sending application creates data slowly or the receiving application consumes data slowly, or both in the sliding window operation • Syndrome created by the sender: • Nagle’s algorithm: accumulate data in the output buffer (simplicity) • Syndrome created by the receiver • Clark’s solution: announce a window size of zero • Delayed acknowledgement Error control • TCP uses three tools: checksum, acknowledgement, and time-out • TCP is no negative acknowledgement in TCP • Lost or corrupted segment, out-of-order segment, lost ACK Computer Networks
Lost segment Computer Networks
Lost acknowledgment Computer Networks
TCP timers • To perform its operation smoothly, TCP uses four timers • Retransmission timer • Retransmission time = 2 X RTT (round-trip time) • RTT = ALPHA(previous RTT) + (1-ALPHA)(current RTT), usually 90% • Karn’s algorithm: when retransmission occurs, RTT ? no update RTT • Persistence timer: To correct the deadlock, for instance, zero window-size announcement case with ACK loss. The sending TCP sends a special segment called a probe Computer Networks
Pushing Data and Urgent Data • The application program on the sending site can request a push operation. This means that the sending TCP should not wait for the window to be filled and must create a segment and send it immediately • The sending TCP can also set the push bit (PSH) to tell the receiving TCP that it must be delivered to the receiving application ASAP. • The sending application wants a piece of data to be read out of order by the receiving application by sending urgent bytes • If URG bit is set, the receiving TCP extracts the urgent data from the segment, using the value of the urgent pointer, and delivers it, out of order, to the receiving application Computer Networks