LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   plz plz help me regarding route mapping (https://www.linuxquestions.org/questions/programming-9/plz-plz-help-me-regarding-route-mapping-204211/)

nedian123 07-12-2004 03:55 PM

plz plz help me regarding route mapping
 
hi,

Actually i have to count number of routers to reach a specific IP. What i did is i created a packet with the help of DatagramPacket class and used the method "setAddress(InetAddress ip)".NOTE:I m sending the packet to my self...
DatagramPacket obj3= new DatagramPacket(data1,10,obj2.getLocalHost(),25);
Now since this class sends the packet thru a connectionless facility.
therefore i didn't used the DatagramSocket function connect.
Then i used the function of class DatagramSocket the function is
send(obj3);

Now to count number of routers i have to use the abstract class DatagramSocketImpl and its method getTimeToLive() and setTimeToLive()

Since these methods are abstract what would be its implementation.......
Shall i receive that sent packet(which was sent to me by myself) how will i access its new TTL value updated by ROUTER........, with which function i will get the intermediate IP's(i.e. Router IP's)


Kindly solve my problem...............

deiussum 07-13-2004 08:17 AM

Are you trying to create a traceroute type functionality? I'm not familiar with the objects you are using (are those Java objects??), but I know a bit about how trace route works.

For a typical trace route, you generally try to send a series of pings to your destination IP, with each of the pings having an incrementing time to live value. The time to live is decremented by each router that passes it on until it gets to 0. If it gets to 0, the router sends some form of a nack back.

So, you start out by sending a ping with a TTL of 1. The first router to get it will nack back. Then you send a ping with a TTL of 2. The second router will nack back. Etc. etc.

If you want more details of how traceroute works, there is probably an RFC describing it somewhere. Do a search at http://www.faqs.org/rfcs/ Also, you might be able to find the source to the linux traceroute implementation.


All times are GMT -5. The time now is 04:45 PM.