It is our suggestion before going into details of connection related issues, it would be better we just spent 2 minutes to scroll thought the usage and functioning of RESET flag. Because RESET shall be used to resolve some of the tricky situations in TCP.
It is a situation where a host sends SYN to another host in order to establish connection but first SYN got delayed or timed-out the expected response time, Here host retransmitted SYN to establish connection now there are two SYN in network to establish connection from same node. Let's see how TCP handles this situation.
Below diagram shall give a better idea of situation.
|Old Duplicate SYN Detection|
1)Host-A triggers SYN segment to establish connection with Host-B and stores the expected ACK of sequence number, goes in SYN-SENT state. For instance this segment got delayed in network and reaches to Host-B after the time of expected response has elapsed. Now Host-B goes into SYN-RECEIVED state.
2)As in expected response time Host-A does not get response from Host-B therefore Host-A triggers another SYN with new sequence number and expected ACK for sequence is changed to new sequence number i.e 2000 thinking previous SYN has lost.
3)Host-A receives SYN-ACK for SYN sent in step-1. As can clearly understand that it is an un-expected ACK because Host-A expecting the ACK for sequence number 2000.
4)Now Host-A after processing received ACK, triggers RESET in order to achieve synchronization of sequence number. On receive of RESET Host-B goes back to LISTEN state.
5)SYN sent in step-2, reaches at Host-B that is LISTEN state excepts it and again goes back to SYN-RECEIVED state.
6)Host-B sends SYN-ACK toward Host-A , Host-A check that now SYN-ACK received is valid.
7)Host-A trigger ACK and goes in ESTABLISHED state. Now Host-B checks received segment, founds valid and goes in ESTABLISHED state.
Your Comments /Suggestions and Questions are always welcome. We would try to clarify doubts with best of our knowledge. So feel free to put Questions.