Ch11:TCP
TCP
TCP is a process-to-process protocol. TCP uses port numbers. TCP is connection-oriented, reliable protocol. It adds connection oriented and reliability features to the service of IP.
TCP allows the sending process to deliver data as stream of bytes and allows the receiving process to obtain data as a stream of bytes.
TCP creates an environment in which the two processes seem to be connected by an Imaginary “Tube” that carries their data across the internet.
At the transport layer TCP groups a number if bytes together into a data unit called . TCP adds a header to each segment and delivers the segment to the IP layer for transmission. The segments are encapsulated in an datagram and transmitted.
TCP offers full-duplex service, where data can flow in both directions at the same time.
TCP is a connection-oriented protocol. When a process at site A wants to send and receive data from another process at site B.
- The two TCPs establish a connection between them.
- Data are exchanged in both directions.
- The connection is terminated.
Numbering system
There are two fields called the and the . These two fields refer to the byte number not the segment number.
The numbering starts with a randomly generated number. After the bytes have been numbered TCP assigns the sequence number to each segment that is being sent. The sequence number of each segment is the number of the first byte carried in the segment.
The value of the acknowledgment field is a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative. The term cumulative means that if a party uses 5643 as an acknowledgment number, it has received all bytes from the beginning up to 5642.
TCP provides . The receiver of the data controls how much data are to be sent by the sender. This is done to prevent the receiver from being overwhelmed with data.
TCP takes into account in the network. The amount of data sent by a sender is also determined by the level of congestion in the network.
TCP segment format
The segment consists of a 20~60 byte header followed by data from the application program.
- Source port address
- Destination port address
- Sequence number This 32-bit field defines the number assigned to the first byte of data contained in this segment.
- Acknowledgment number This 32-bit field defines the byte number that the receiver of the segment is expected to receive from another party. Acknowledgment and data can be piggybacked together.
- Header Length(HLEN) This 4-bit field indicated the number of 4-byte words in the TCP header. The length of the header can be between 20 and 60. So this can be between 5 and 15.
Lecture 26
- Control This field defines 6 different control bits or flags. One or none of these bits can be set at a time. URG: indicates that the Urgent pointer field is significant ACK: ndicates that the Acknowledgment field is significant. All packets after the initial SYN packet sent by the client should have this flag set. PSH: Push function. Asks to push the buffered data to the receiving application. RST: Reset the connection SYN: Synchronize sequence numbers. Only the first packet sent from each end should have this flag set. Some other flags and fields change meaning based on this flag, and some are only valid for when it is set, and others when it is clear. FIN: Last package from sender.
-
Window size This field is defines the size of the windows size in bytes. The other party must maintain. This values is determined by the receiver. The sender must obey the dictation of the receiver in this case.
RWND: Receivers windows size CWND: Congestion window size
- Checksum
-
Urgent pointer This 16-bit field is valid only if the urgent flag is set. It defines the number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment.
- Option There can be up to 40 bytes of optional information in the TCP header.
Connection establishment using
-
The client sends the first segment, a “SYN” segment in which only the “SYN” flag is set. This segment is for synchronization of sequence numbers. The client choose a random number as the first sequence number.
-
The server sends the second
Data transfer
Connection termination using
Sliding window Window size = min(rwnd, cwnd) move the closing on the left according to receiving ACK move the opening on the right according to closing + window size Shrinking window when rwnd or cwnd is reduced. This situation is not allowed in most implementation.
Comments