Sending Hop Limited UDP packets  
Author Message
Ashoka!





PostPosted: 2007-4-10 16:23:00 Top

java-programmer, Sending Hop Limited UDP packets 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

 
Knute Johnson





PostPosted: 2007-4-11 0:16:00 Top

java-programmer >> Sending Hop Limited UDP packets Ashoka! wrote:
> 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?

--

Knute Johnson
email s/nospam/knute/
 
Gordon Beaton





PostPosted: 2007-4-11 0:23:00 Top

java-programmer >> Sending Hop Limited UDP packets On Tue, 10 Apr 2007 09:15:49 -0700, Knute Johnson wrote:
> 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

--
 
 
Esmond Pitt





PostPosted: 2007-4-11 17:09:00 Top

java-programmer >> Sending Hop Limited UDP packets Ashoka! wrote:
> 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.
 
 
Gordon Beaton





PostPosted: 2007-4-11 17:23:00 Top

java-programmer >> Sending Hop Limited UDP packets On Wed, 11 Apr 2007 09:09:12 GMT, Esmond Pitt wrote:
> 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

--
 
 
Esmond Pitt





PostPosted: 2007-4-12 8:21:00 Top

java-programmer >> Sending Hop Limited UDP packets Gordon Beaton wrote:
> On Wed, 11 Apr 2007 09:09:12 GMT, Esmond Pitt wrote:
>
>>Use a MulticastSocket so you get the setTimeToLive() API and just
>>send to a unicast address.
>
> 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.
 
 
Ashoka!





PostPosted: 2007-4-26 19:42:00 Top

java-programmer >> Sending Hop Limited UDP packets I am trying to implement the tailgating algorithm to measure internet
bandwidth.

On Apr 12, 5:21 am, Esmond Pitt <email***@***.com>
wrote:
> Gordon Beaton wrote:
> > On Wed, 11 Apr 2007 09:09:12 GMT, Esmond Pitt wrote:
>
> >>Use a MulticastSocket so you get the setTimeToLive() API and just
> >>send to a unicast address.
>
> > 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.