0

When establishing a connection, TCP uses three-way handshake.

step 1: client send SYN to server
step 2: server send SYN/ACK to client
step 3: client send ACK to server

But, in step 1, 2 or 3, packet may be lost.
I have 3 questions, please help me on that.

  1. How TCP handle packet loss during three-way handshake ?
  2. Is there any ways to simulate the packet loss issues ?
  3. TCP handle the problem automatically or developer must also handle it ?

Thanks for any advice.

Thach Pham
  • 98
  • 5
  • 2
    It does not matter how stack copes with such loses. It either perform re-transmits or does nothing. You can't control it so it does not matter how stack does its work. You will either connect or get connection timeout. That is all you should care about. – Maxim Sagaydachny Dec 17 '19 at 13:10

1 Answers1

2

How TCP handle packet loss during three-way handshake ?

Retransmission, as with any other kind of packet loss. That's why you have ACK's in the handshake.

Is there any ways to simulate the packet loss issues ?

Sure but it depends on your knowledge. For example in Linux in iptables (firewall) rule could be created which drops some but not all SYN packets. See also Simulate delayed and dropped packets on Linux.

TCP handle the problem automatically or developer must also handle it ?

This is transparent to the developer. At most the applications gets a connection failure (timeout).

user207421
  • 305,947
  • 44
  • 307
  • 483
Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172