1
8.6kviews
Explain three ways handshake technique in TCP.
1 Answer
1
201views

WAY HANDSHAKE TECHNIQUE IN TCP

(I) Connection Establishment

To establish a connection, it would seem that one transport entity should send a CONNECTION REQUEST TPDU and should wait for a CONNECTION ACCEPTED REPLY (This is called a 2 Way Handshake). But actually the process is not so simple. Problems arise when the network can lose, store and duplicate packets.

Consider the Problem:

A user establishes a connection with a bank and sends messages telling the bank to transfer money from the user’s account to somebody’s else’s account and then terminates the connection. Now if this message is stored and duplicated then a serious problem will occur. These stored and duplicated messages will keep surfacing at the bank and the bank will consider them as new messages. Thus the bank will repeatedly establish a connection and transfer money from the user account to someone else’s account! This is the problem that exists with the 2 way handshake.

To Solve this Problem We Use the 3 Way Handshake

(a) Normal Procedure:

Step 1: Host 1 sends a CONNECTION REQUEST TPDU containing a sequence number x to Host 2.

Step 2: Host 2 replies with an ACK TPDU acknowledging x and announcing its own initial sequence number, y.

Step 3: Host 1 acknowledges Host 2’s initial sequence number and sends the first data TDPU.

(b) 3 Way Handshake Eliminates Duplicate Packets Problem:

Step 1: A duplicate CONNECTION REQUEST TPDU containing a sequence number x is sent to Host 2 from an old connection. Host 2 is not aware that this is a duplicate TDPU.

Step 2: Host 2 replies with as ACK TPDU acknowledging its own initial sequence number, y.

Step 3: Host 1 realizes that a duplicate packet from an old connection has been received by Host

  1. Host 1 rejects the connection.

(c) 3 Way Handshake Eliminates Duplicate Packets And Duplicate Acknowledgements Problem:

Step 1: As in the previous case Host 2 gets a duplicate CONNECTION REQUEST TPDU and acknowledges it.

Step 2: Note that Host 2 has proposed using y as the initial sequence number.

Step 3: There is a delayed data TPDU which has sequence number=x and is acknowledging z. When this TPDU reaches Host 2, Host 2 will reject it because the acknowledgement in the TDPU is for z and not y.

Step 4: Also Host 1 will realize that a duplicate packet has been received by Host 2 and will thus reject the connection.

(II) Connection Release

There are two styles of terminating a connection:

(1) Asymmetric Release: It means that no more data can be sent or received by the host issuing the release.

(2) Symmetric Release: It means that the host issuing the release cannot send any more data but data can be received by it.

Release using the 3 Way Handshake

(a) Normal Case:

Step 1: Host 1 sends DISCONNECTION REQUEST TPDU (DU) to initiate connection release.

Step 2: When Host 2 receives this it also sends a DR to Host 1 and starts a timer.

Step 3: Now Host 1 releases the connection and sends an ACK TPDU to Host 2. When Host 2 receives the ACK TPDU it can also release its connection.

(b) ACK is Lost:

When ACK is lost, the timer started on Host 2 times out and Host 2 releases the connection anyway.

(c) DR from Host 2 is lost:

As Host 1 does not get the expected response it times out and resends the DR.

(d) Response Lost and Subsequent DRs Lost:

In this case after Host 1 times-out N number of times it will give up and simply release the connection. Meanwhile Host 2 will also timeout and release the connection.

Please log in to add an answer.