3

In Java, is there a way to control the TTL of the IP header for packets sent on a socket?

DGentry
  • 16,111
  • 8
  • 50
  • 66

2 Answers2

2

Apparently only on Multicast sockets, which have:

MulticastSocket.setTimeToLive(int ttl);
Alnitak
  • 334,560
  • 70
  • 407
  • 495
1

Setting the TTL using

MulticastSocket.setTimeToLive(int ttl);

is only going to work if you have enabled the IPV4Stack as outlined by this other question

Java Multicast Time To Live is always 0

-Djava.net.preferIPv4Stack=true
Community
  • 1
  • 1
pfranza
  • 3,292
  • 2
  • 21
  • 34