1

How do i retrieve (programmatically) the TTL/hop count value for the received data/packets of a TCP stream on a Linux (or any other posix systems altough linux-only solutions are welcome too) system?

I know that I would then not know the initial TTL but I would still be able to see the changes of that value. I would then know if the route of the tcp-stream would be changed, helping me to explain changes in latency.

I would be using this knowledge in httping: I'm trying to give the user handles to explain what the cause might be of certain latencies.

Folkert van Heusden
  • 433
  • 4
  • 17
  • 38
  • Related, but for UDP instead of TCP: http://stackoverflow.com/questions/16165542/is-it-possible-to-read-ip-header-fields-for-received-udp-packet – Celada Apr 23 '13 at 15:15
  • I suspect that it's impossible with TCP because the data that are read through a stream socket do not necessarily correspond to specific packets on the wire. If you `read()` 12 bytes of which 6 came from a TCP segment from one IP packet and 6 came from a different packet, and the two IP packets did not have the same TTL, what's the TTL value that corresponds to those 12 bytes? What about if some of the bytes got transmitted and received twice and the same byte literally came from two different IP packets (with different TTLs)? – Celada Apr 23 '13 at 15:18

0 Answers0