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.

  1. The two TCPs establish a connection between them.
  2. Data are exchanged in both directions.
  3. 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.

Lecture 26

Connection establishment using

  1. 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.

  2. 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.