Sending Hop Limited UDP packets

A

Ashoka!

Is there a way to send a UDP packet with a specific TTL however it
must be a unicast address instead of multicast address. Any ideas?

regards
Usman Ismail
 
K

Knute Johnson

Ashoka! said:
Is there a way to send a UDP packet with a specific TTL however it
must be a unicast address instead of multicast address. Any ideas?

regards
Usman Ismail

I think you would have to write your own DatagramSocketImpl. But I'm
curious as to why you would want a TTL on a unicast UDP packet. Do you
not want it to get to it's address?
 
G

Gordon Beaton

I think you would have to write your own DatagramSocketImpl. But I'm
curious as to why you would want a TTL on a unicast UDP packet. Do
you not want it to get to it's address?

It's one way of implementing traceroute, but I can't think of any
other uses.

/gordon

--
 
E

Esmond Pitt

Ashoka! said:
Is there a way to send a UDP packet with a specific TTL however it
must be a unicast address instead of multicast address. Any ideas?

Use a MulticastSocket so you get the setTimeToLive() API and just send
to a unicast address.
 
G

Gordon Beaton

Use a MulticastSocket so you get the setTimeToLive() API and just
send to a unicast address.

Does that actually work?

I was going to make the same suggestion earlier, but tested first and
couldn't see (with Wireshark) that the setting had any effect on
unicast packets. The documentation seems to confirm this:

"Set the default time-to-live for *multicast* packets sent [...]"

/gordon

--
 
E

Esmond Pitt

Gordon said:
Does that actually work?

oops, err, hmm, maybe not ... on investigation it turns out that there
are both IP_TTL and IP_MULTICAST_TTL, and
MulticastSocket.setTimeToLive() sets the latter, and the OP wants the
former ...

so you can't do it in Java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top