Question: TCP Connection Management
2

MU > Computer Engineering > SEM-5 > Computer Netwoks >

Marks: 10

Year: MAY-2015

ADD COMMENTlink
modified 3.1 years ago  • written 3.1 years ago by gravatar for Sagar Narkar Sagar Narkar1.5k
3
  1. In TCP, the connections are established using three way handshake technique.
  2. TCP Connection Management includes TCP Connection Establishment & TCP Connection Release.

TCP Connection Establishment:

  1. To establish a connection, one side, say, the server, passively waits for an incoming connection by executing the LISTEN and ACCEPT primitives, either specifying a specific source or nobody in particular.

  2. The other side, say, the client, executes a CONNECT primitive, specifying the IP address and port to which it wants to connect, the maximum TCP segment size it is willing to accept, and optionally some user data (e.g., a password).

  3. The CONNECT primitive sends a TCP segment with the SYN bit on and ACK bit off and waits for a response.

  4. When this segment arrives at the destination, the TCP entity there checks to see if there is a process that has done a LISTEN on the port given in the Destination port field.

  5. If not, it sends a reply with the (Reset) RST bit on to reject the connection.

  6. If some process is listening to the port, that process is given the incoming TCP segment.

  7. It can then either accept or reject the connection.

  8. Normal case is shown in Figure (a).

  9. In the event that two hosts simultaneously attempt to establish a connection between the same two sockets, the sequence of events is as illustrated in Figure (b).

  10. The result of these events is that just one connection is established, not two because connections are identified by their end points.

enter image description here

TCP Connection Release:

  1. TCP connections are full duplex.

  2. Each simplex connection is released independently of its sibling.

  3. To release a connection, either party can send a TCP segment with the FIN bit set, which means that it has no more data to transmit.

  4. When the FIN is acknowledged, that direction is shut down for new data.

  5. Data may continue to flow indefinitely in the other direction, however.

  6. When both directions have been shut down, the connection is released.

  7. Normally, four TCP segments are needed to release a connection, one FIN and one ACK for each direction.

  8. However, it is possible for the first ACK and the second FIN to be contained in the same segment, reducing the total count to three.

  9. To avoid the two-army problem, timers are used.

  10. If a response to a FIN is not forthcoming within two maximum packet lifetimes, the sender of the FIN releases the connection.

  11. The other side will eventually notice that nobody seems to be listening to it anymore and will time out as well.

  12. While this solution is not perfect, given the fact that a perfect solution is theoretically impossible, it will have to do. In practice, problems rarely arise.

Finite State Machine for Connection Establish & Release:

enter image description here

  1. In each of the 11 states shown in above table, some specific events are legal.

  2. Corresponding to every legal event some action may be taken, but if some other event happens, then error is reported.

  3. Each Connection is always in the CLOSED State Initially.

  4. It comes out of this state when it does either the passive open (LISTEN) or an active open (CONNECT).

  5. A connection is established, if the other side does the opposite and the state becomes ESTABLISHED.

  6. When the both the sides initiate a connection release the connection is terminated and the state returns to CLOSED state.

enter image description here

ADD COMMENTlink
written 3.1 years ago by gravatar for Sagar Narkar Sagar Narkar1.5k
Please log in to add an answer.