Sending Hop Limited UDP packets

Discussion in 'Java' started by Ashoka!, Apr 10, 2007.

  1. Ashoka!

    Ashoka! Guest

    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
     
    Ashoka!, Apr 10, 2007
    #1
    1. Advertising

  2. 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/
     
    Knute Johnson, Apr 10, 2007
    #2
    1. Advertising

  3. 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

    --
     
    Gordon Beaton, Apr 10, 2007
    #3
  4. Ashoka!

    Esmond Pitt Guest

    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.
     
    Esmond Pitt, Apr 11, 2007
    #4
  5. 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

    --
     
    Gordon Beaton, Apr 11, 2007
    #5
  6. Ashoka!

    Esmond Pitt Guest

    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.
     
    Esmond Pitt, Apr 12, 2007
    #6
  7. Ashoka!

    Ashoka! Guest

    I am trying to implement the tailgating algorithm to measure internet
    bandwidth.

    On Apr 12, 5:21 am, Esmond Pitt <>
    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.
     
    Ashoka!, Apr 26, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Chin

    receive udp packets on windows xp

    Andrew Chin, Dec 8, 2005, in forum: Java
    Replies:
    3
    Views:
    948
    Roedy Green
    Dec 8, 2005
  2. Janto Dreijer

    UDP packets to PC behind NAT

    Janto Dreijer, Sep 15, 2006, in forum: Python
    Replies:
    12
    Views:
    888
    John J. Lee
    Sep 17, 2006
  3. Pashlipops

    Reading packets from UDP port

    Pashlipops, Oct 15, 2006, in forum: C++
    Replies:
    3
    Views:
    881
  4. sreehari
    Replies:
    7
    Views:
    357
  5. Xanti

    disappiring UDP packets

    Xanti, Mar 8, 2007, in forum: Java
    Replies:
    1
    Views:
    274
    Daniel Pitts
    Mar 8, 2007
Loading...

Share This Page