Computer Networks (CS425) : Transport Layer Protocol
Computer Networks (CS425) : Transport Layer Protocol
TCP B
1.
CLOSED
LISTEN
2.
SYN-SENT
--> <SEQ=100><CTL=SYN>
--> SYN-RECEIVED
3.
<-- SYN-RECEIVED
4.
5.
--> ESTABLISHED
In line 2 of above figure, TCP A begins by sending a SYN segment indicating that it will use sequence numbers starting with sequence number
100. In line 3, TCP B sends a SYN and acknowledges the SYN it received from TCP A. Note that the acknowledgment field indicates TCP B is
now expecting to hear sequence 101, acknowledging the SYN which occupied sequence 100.
At line 4, TCP A responds with an empty segment containing an ACK for TCP B's SYN; and in line 5, TCP A sends some data. Note that the
sequence number of the segment in line 5 is the same as in line 4 because the ACK does not occupy sequence number space (if it did, we would
wind up ACKing ACK's!).
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec14.html
1/3
11/8/2014
Simultaneous initiation is only slightly more complex, as is shown in figure below. Each TCP cycles from CLOSED to SYN-SENT to SYNRECEIVED to ESTABLISHED.
TCP A
TCP B
1.
CLOSED
CLOSED
2.
SYN-SENT
3.
4.
... <SEQ=100><CTL=SYN>
--> <SEQ=100><CTL=SYN>
...
<-- SYN-SENT
--> SYN-RECEIVED
5.
6.
ESTABLISHED
7.
--> ESTABLISHED
Question: Why is three-way handshake needed? What is the problem if we send only two packets and consider the connection established? What
will be the problem from application's point of view? Will the packets be delivered to the wrong application?
Problem regarding 2-way handshake
The only real problem with a 2-way handshake is that duplicate packets from a previous connection( which has been closed) between the two
nodes might still be floating on the network. After a SYN has been sent to the responder, it might receive a duplicate packet of a previous
connection and it would regard it as a packet from the current connection which would be undesirable.
Again spoofing is another issue of concern if a two way handshake is used.Suppose there is a node C which sends connection request to B saying
that it is A.Now B sends an ACK to A which it rejects & asks B to close connection.Beteween these two events C can send a lot of packets which
will be delievered to the application..
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec14.html
2/3
11/8/2014
The first two figures show how a three way handshake deals with problems of duplicate/delayed connection requests and duplicate/delayed
connection acknowledgements in the network.The third figure highlights the problem of spoofing associated with a two way handshake.
Some Conventions
1. The ACK contains 'x+1' if the sequence number received is 'x'.
2. If 'ISN' is the sequence number of the connection packet then 1st data packet has the seq number 'ISN+1'
3. Seq numbers are 32 bit.They are byte seq number(every byte has a seq number).With a packet 1st seq number and length of the packet is sent.
4. Acknowlegements are cummulative.
5. Acknowledgements have a seq number of their own but with a length 0.So the next data packet have the seq number same as ACK.
Connection Establish
The sender sends a SYN packet with serquence numvber say 'x'.
The receiver on receiving SYN packet responds with SYN packet with sequence number 'y' and ACK with seq number 'x+1'
On receiving both SYN and ACK packet, the sender responds with ACK packet with seq number 'y+1'
The receiver when receives ACK packet, initiates the connection.
Connection Release
The initiator sends a FIN with the current sequence and acknowledgement number.
The responder on receiving this informs the application program that it will receive no more data and sends an acknowledgement of the
packet. The connection is now closed from one side.
Now the responder will follow similar steps to close the connection from its side. Once this is done the connection will be fully closed.
Image References
http://www.renoir.vill.edu/~cassel/4900/transport.html
www.uga.edu/~ucns/lans/tcpipsem/close.conn.gif
www.uga.edu/~ucns/lans/tcpipsem/establish.conn.gif
back to top
Prev| Next | Index
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec14.html
3/3