Ftp – Packet loss during TCP handshake

ftppacketpacketlosstcp

I have to implement a pseudo TCP handshake that leads into a file transfer. I have no problem doing the file transfer: simple send-acknowledge. What I can't wrap my head around is how to do the three way handshake assuming there will be packet loss during one of the 3 steps.

For instance:
My client sends a SYN packet. If it times out (packet loss or just slow) waiting for SYN-ACK, it resends it. Server sends SYN-ACK. If it times out waiting for ACK, resend SYN-ACK. Now how does the client now that his ACK was received?

Best Answer

The client doesn't know that his ACK was received, but why does he care? The connection is established whether or not the ACK is received. You will never know for sure that the last packet sent was received, so you have to design a protocol that doesn't require that.

Related Topic