2

I am experiementing with verification of TCP protocol and its loss-tolerance feature. In a client and server pair, I want to detect retransmission of packets for which there is no acknoledgement due to lost packets. TCP does retransmission but is there a way to programmatically detect this in client / server program.

Yogi Joshi
  • 786
  • 1
  • 6
  • 19
  • possible duplicate of [What are the retransmission rules for TCP?](http://stackoverflow.com/questions/12956685/what-are-the-retransmission-rules-for-tcp) – Christophe Aug 04 '15 at 21:27
  • Python compiles down to C and there are many useful packages. Not sure if there is a way, but python will help you avoid writing pages of code. – The Brofessor Aug 04 '15 at 21:27
  • It may be useful to get a [packet analyzer](https://en.wikipedia.org/wiki/Comparison_of_packet_analyzers) – user3386109 Aug 04 '15 at 21:31
  • you could use netstat as stated http://serverfault.com/questions/318909/how-passively-monitor-for-tcp-packet-loss-linux, you need just to call this from your program – unique_ptr Aug 04 '15 at 21:34

1 Answers1

2

Method1: Check retransmission with sequence number

If the packet is retransmitted, its sequence number remains the same. You can store the all sequence numbers of all transmitted packets. At each transmission check if you've already encountered this sequence number. If you have, its a retransmission. It you havent, add it to the data structure.

Method2: Out of order transmissions

As packet sequence number remains the same in retransmission and because of the fact that sequence numbers increase monotonically. You can check if for every transmission if the sequence number of current packet is less than the previous packet. If it is, its a retransmission.

Sidenote: This is how packet analyzers like WireShark mark packets as retransmissions

Shreyas Chavan
  • 1,079
  • 1
  • 7
  • 17
  • I think the hard question is not how to mark retransmissions *given the necessary data to do so*, but how to get to that data. – Paul Groke Aug 04 '15 at 21:41