File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Traceroute in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Traceroute in Java" Watch "Traceroute in Java" New topic
Author

Traceroute in Java

Andy James
Ranch Hand

Joined: Aug 22, 2005
Posts: 90
Is it possible to implement Traceroute in Java, since Java does not suppoorts low level networking.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
Check out the jpcap library (on SourceForge). It's a JNI wrapper around some functionality of the native TCP/IP stack that allows you to do this in Java. Here's example code that does that: http://netresearch.ics.uci.edu/kfujii/jpcap/sample/Traceroute.java
Andy James
Ranch Hand

Joined: Aug 22, 2005
Posts: 90
Hi

JPCap requires a user to install c/c++/c# libraries to execute the Traceroute code.

However, The following "seems" to execute the Traceroute using a Java Applet (only Java) because it does not requires a user to download any libraries/ files to display the traceroute from their server to the user's machine.

My queries:
1) Is it possible to implement Traceroute using (only) Java?
2) Is it possible to implement the Traceroute in Java as an Applet?

Am I missing something here?

Andy
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
I'm not sure what you mean by "the following" (did you mean to add a link?), but traceroute can't be implemented in Java w/o using native libraries, because Java does not support the low-level ICMP protocol used by traceroute.
Andy James
Ranch Hand

Joined: Aug 22, 2005
Posts: 90
Hi Ulf

I apologize for the missing link. Here it is:

http://visualroute.visualware.com/

The above links displays an applet, which performs the traceroute and displays the result on the web page. Since it did not prompt me to download and install any file to use it, I assume it is done in Java (not sure)

Thanks.
Andy
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Andy -- if you look carefully at that applet, you'll see that by default it offers to run a traceroute from "This Server". You can also use the popup menu to choose "My Computer". If you run the traceroute from "This Server", then it runs from the web server, and of course you don't know what kind of code is located there. If you pick "My Computer", it does indeed ask you to download something first.


[Jess in Action][AskingGoodQuestions]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
If you do want to go the applet route, note that it's possible to ship native libraries with an applet, as long as all involved files are digitally signed. You'd have to supply versions for all client OSes you want to support, though (Windows, OS X, Linux, etc.).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Traceroute in Java