I am creating a custom protocol over UDP and I want to use a low number of bits for the sequence number. This means that the number can wrap relatively fast. Is setting the TTL for the outgoing packets to a low value a way to ensure that any packet received was actually sent less than TTL time ago?

  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 23, 2021 at 16:08

1 Answer 1


No. The IP packet TTL effectively counts down the L3 or router hops the packet takes. Setting the TTL to a custom value n ensures that the packet cannot take more than n hops on its path. If it does it is discarded by the router on the nth hop.

TTL started out as a combined time/hop counter (hence its name) but quickly evolved to becoming a hop counter only.

To accomplish what you're asking you'd need to use a larger sequence counter or include an actual timestamp. Actually, using a 32-bit sequence counter covers extensive ground while taking up just four bytes in the datagram. Depending on the packet frequency, even 16 bit might suffice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.