TCP sequence number
I would like to know if two segments of same sequence number arrive at the destination, which segment will get accepted ?
For eg:
A clients sends a packet to a server and wait for an acknowledgement . But it didnt received the ack(due to some network problem , this segment takes time to reach the server) within the timeline so starts sending the same segment again. Now at server side, what happens if the both the packets reach at the same time.
One packet gets marked as a duplicate and discarded. Since they're identical, it doesn't matter which one that is. See https://stackoverflow.com/questions/12871760/packet-loss-and-packet-duplication
The premise that both segments arrive at the same time does not make sense. One will always arrive before the other. But that data may not have been delivered to the application before the next arrives.
According to RFC 793 the data from the first segment is to be used.
Segments are processed in sequence. Initial tests on arrival are used to discard old duplicates, but further processing is done in SEG.SEQ order. If a segment's contents straddle the boundary between old and new, only the new parts should be processed.
That said, it isn't hard to imagine implementations in reality behaving differently. In particular partially overlapping segments can be quite interesting.