Single segment: (Eg. no more data to send), and that packet s lost, the sender will eventually time out and resend the segment. There’s no way for the receiver to know that there was a segment in flight, so it can’t tell you that it didn’t get it.
Multiple segments
One in the middle has been lost
Receiver will send out an ACK for every new segment
ACK: highest octet of the segment that arrived in sequence
Eg. Sender transmits 1460 octet segments with initial seq no. of 1, 1461, 2921, 4380, and 5840, and the 2921 segment gets lost, it send back ACK of (2920, 2920, 2920, 2920).
First segment skipped because of delatyed ACK (???)
So it’ll detect duplicate ACKs and retransmit missing segments. Selective ACK(SACK) can also help here.
TODO TCP Handshake?
TODO UDP is connectionless, but UDP has connection tuple?