180 likes | 296 Vues
26-TCP. Dr. John P. Abraham Professor UTPA. TCP. Transmission control protocol, another transport layer protocol. Reliable delivery Tcp must compensate for loss, delay, duplication and out of order delivery that are introduced by IP. Packet in TCP is called a segment.
E N D
26-TCP Dr. John P. Abraham Professor UTPA
TCP • Transmission control protocol, another transport layer protocol. • Reliable delivery • Tcp must compensate for loss, delay, duplication and out of order delivery that are introduced by IP. • Packet in TCP is called a segment
Service provided to applications • Connection orientation • Point-to-point (end to end) • Reliability • Full duplex • Stream interface • Reliable connection startup and gracefull connection shutdown
Virtual connections • End-to-end provides service to application from end to the other. • Virtual connection is established. Virtual connection is achieved by the software (underlying hardware does not have a real connection between the two points). The tcp software on the two machines exchange messages to achieve the connection. • Uses IP to carry the data.
Sequencing to handle duplicates and out of order delivery • The sending side attaches a sequence number to each packets. The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number. • The receiving side stores both the sequence number of the last packet arrived in order as well as a list of additional packets that arrived out of order. • If packet arrived in order it hands it to the higher layer and checks the pending out of order list, if any can be handed to the higher layer. • If packet arrived out of order, it adds it to the out of order list. • If a duplicate arrived (below the current sequence number, or already in the out of order list) it is discarded.
Example 2 Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered 10001. What are the sequence numbers for each segment if data is sent in five segments, each carrying 1000 bytes? SolutionThe following shows the sequence number for each segment: Segment 1➡ Sequence Number: 10,001 (range: 10,001 to 11,000) Segment 2➡ Sequence Number: 11,001 (range: 11,001 to 12,000) Segment 3➡ Sequence Number: 12,001 (range: 12,001 to 13,000) Segment 4➡ Sequence Number: 13,001 (range: 13,001 to 14,000) Segment 5➡ Sequence Number: 14,001 (range: 14,001 to 15,000)
Retransmission to handle lost packets • To handle packet lost tcp uses positive acknowledgement with retransmission. • Whenever a frame arrives intact, the receiving protocol sends a small ACK that repots successful reception. • When a packet is sent the sending side starts a timer. If the ACK is not received before the timer ends the packet is re-transmitted. • If an ACK is received for a later packet, all packets upto that point is considered ACKed.
Acknowledgement field The value in the sequence number field of a segment defines the number of the first data byte containedin 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.
Selective ACK • Relying purely on the cumulative acknowledgment scheme employed by the original TCP protocol can lead to inefficiencies when packets are lost. For example, suppose 10,000 bytes are sent in 10 different TCP packets, and the first packet is lost during transmission. In a pure cumulative acknowledgment protocol, the receiver cannot say that it received bytes 1,000 to 9,999 successfully, but failed to receive the first packet, containing bytes 0 to 999. Thus the sender may then have to resend all 10,000 bytes. • In order to solve this problem TCP employs the selective acknowledgment (SACK) option, defined in RFC 2018, which allows the receiver to acknowledge discontinuous blocks of packets that were received correctly
Flow control to prevent data overrun • Covered sliding window already. • 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.
Techniques to avoid congestion • When transmission exceeds the capacity of a receiving device (usually router), we have congestion. • Retransmission can only worsen the situation, may lead to congestion collapse. • To avoid this routers inform senders about congestion. Congestion is estimated based on packet delays and packet losses. • A reduced window size is sent to the sender. A size of 0 means, do not send any more. • If a receiver can’t handle received data, it will begin to reduce its window size. If this is repeated to the point that the header is more that the payload, a situation called “silly window syndrome” occurs.
Three-way and shake • To guarantee that connections are established or terminated reliably. • 3 messages are exchanged, each side sends a control message that specifies an initial buffer size and a sequence number. • Send synreceive synsend back syn + ackreceve syn+ack and send ackreceive ack. • To close a connection send fin+ackreceive it and send fin+ackreceive it and send ackreceive ack.
3-way-handshake Handshake segments cannot carry data, but consumes sequence numbers.