In the process of TCP 3-Way Handshake, we can see this diagram often.
We can notice that the client socket state changes to [established]
after received the 2nd packet.
What happens if the 3rd packet (client ACK) is missing?
in client:
int client_fd=connect(a,b);
Does connect()
return after the 2nd packet is received?
What if the 2nd packet is missing? Does the server keep sending SYN-SENT
packets?
And why does the server need to receive the 3rd packet before changing state to [established]
? Why not change state to [established]
after receiving the 1st packet?
I have been programming for a few years now, but I cannot understand this.
[update1:]——————————————–
thanks to all.
accroding to @user4581301,Andrew Henle,
I open https://www.ietf.org/rfc/rfc793.txt [Page 22] , https://datatracker.ietf.org/doc/html/rfc9293#name-state-machine-overview [3.3.2. State Machine Overview]
and with @user207421 says,
My understanding is :
we call the 3-way paket,say packet1[CLIENT-SYN],packet2[SERVER-ACK-SYN],packet3[CLIENT-ACK]
- both CLIENT and SERVER send A SYN,and need to recive A ACK,then the sock state can change to [established],so [3-way] is need
- in tcp,not just retransmittion arise after [established],but also the 3-WAY itself will retransmittion after a packet timeout.
every [seq=x] should waiting a [ACK,ack=x],or the [seq=x] will arise retransmittion.
I will study this rfc more.
I want to konw,
1.how to know the detail lays in rfc doc,on old days,I jus search google and reding some blog and article?
2.does stackoverflow is a good place to ask this kind quesion?
16