Transmission Control Protocol (TCP)

  • TCP is connection oriented protocol and process- to- process protocol.
  • TCP uses flow and error control mechanism at the transport layer, hence TCP is reliable transport protocol.
  • In TCP, a segment carries a data and control information.

Connection Establishment

  • TCP transmits data in both the directions ( full duplex mode).
  • When two TCPs are connected to each other, each TCP needs to initialize the communication (SYN) and approval(ACK) from each end to send the data.
Three - Way Handshaking
The Three - Way Handshaking protocol is used to establish connection between two TCPs.

The steps are

1. A client sends a SYN data packet to server. The purpose of this step is to see if the server is open for new connection.
2. The server needs to keep all ports open to establish a new connection. When the server receives the SYN packet from the client, the client replies and returns the conformation  SYN/ACK packet.
3. The client receives the SYN/ACK packet and replies with ACK packet to establish the connection.

three way handshaking

TCP flow control

TCP provides flow- control mechanism facility.  A receiver can control the data which is sent by the user. This action is taken to prevent the data crash at the receiver's end. TCP uses byte-oriented flow control, according to numbering system.

TCP Congestion Control

  • Congestion occurs, if the load offered to any network is more than its capability.
  • Once the connection is established, the sender can initialize the congestion window size (according to the available buffer space in the receiver).
  • The sender's window size can be determined by the receiver and congestion in the network.
  • The actual size of the window can be  minimum of the receiver-advertised window size and the congestion window size.
Generally, the methods followed by TCP to handle the congestion consists of three phases:

1. Slow start algorithm
Slow start algorithm is used to control the congestion in TCP. In this algorithm, the size of window grows exponentially till the timeout occurs or the receiver's window is reached to the maximum threshold (64 kb = 65535 bytes).

Example:
Suppose that, the sender starts with congestion window = 20  = 1 MSS (Maximum Segment Size, each segment consists of 1byte). After receiving acknowledgement for segment 1, the size of window can be increased by one. Thus, the total size of congestion window = 21 = 2. When all the segments are acknowledged, the total size of congestion window = 23 = 8.

2. Congestion avoidance algorithm
  • In slow start algorithm, the size of the congestion window increases exponentially.
  • To avoid the congestion before it happens, it is necessary to slow down the exponential growth.
  • The Congestion avoidance algorithm works with an additive increase instead of the exponential growth.
  • In this algorithm, after receiving each acknowledgement receipt (for one round), the size of the congestion window can be increased by one.

    Example
    Start with, Congestion window = 1
    By adding 1, congestion window = 1 + 1 = 2
3. Congestion detection algorithm
  • If the congestion occurs, it is required to decrease the congestion window size.
  • There are two conditions in which congestion may occur: the connection time out and the reception of three acknowledgements.
  • In both cases, the threshold size can be dropped to one half of the previous window size.
Example
  • Assume that the window size = 64 and threshold is set to 32.
  • In slow start algorithm, the window size starts from window size = 1, and then grows exponentially.
  • Thereafter, when it reaches to threshold value, the congestion avoidance method allows the window size to increase linearly ( by adding 1). However, the connection time-out occurs and the window size = 36. At this phase, the multiplicative decrease method is applied to the window size 36/2 = 18 (new threshold). Again, TCP starts working with slow start algorithm and the transmission is carried out.

Wireless TCP

  • The wireless transmission links are unreliable and can lose the packets many times. The solution to deal with this problem is to send them again.
  • The path from sender to receiver can be heterogeneous, it may be wired or wireless network. When the path is unknown, it is very difficult to make the correct decision, if the packets get lost.
  • Therefore, the wireless TCP can be split into two separate connections.
  • In first connection, the packets move from sender to the base station and the  mobile receiver receives the data from the base station through  transmitting antenna.
  • The base station can receive the data from the mobile sender through the receiving antenna. This method can solve the time out problem.