File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Developing a traceroute clone

 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently trying to develop a traceroute clone.Can you please tell me how to receive a UDP packet(i know to recieve and send using the default DatagramSocket and DatagramPacket Classes) but they dont allow me to edit the TTL fields.Whats the feasibility in doing this is in Java.
I want to edit the TTL fields :send and receive the packets.

Without using 3rd party libraries like JPCAP

Thanks in advance
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Traceroute doesn't use UDP; it uses a lower level IP protocol called ICMP. J2SE doesn't support ICMP, nor does it support much else in the way of low-level networking. A traceroute clone, while trivial in C, is going to be a difficult mess in Java.
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No solution to get around this.Please anyone help.Im ready to mess with this
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Ernest pointed out, Java doesn't have the functionality you require.
Is there a reason you can't use 3rd party libraries or a more suitable language like C?
[ March 19, 2008: Message edited by: Joe Ess ]
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im now using JPCap.Following errors occuring.Help me please
Environment
Installed Winpcap and jpcap
IDe:Eclipse 3.2
In new java project added jpcap.jar and added their default traceroute.java
Succesfully compiled and got the result saying traceroute syntax is:
traceroute [device number 0,1,2][device name]
When i tried running frm cmd prompt
cmd>java traceroute 0 localhost
It gave me packet/DatalinkPacket Class not found.

Im stuck.How can I get rid of this error.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

cmd>java traceroute 0 localhost
It gave me packet/DatalinkPacket Class not found.

How are you adding the "packet" package to your classpath? I'm guessing this should read

(or ; instead of : if you're using Windows)
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya Netbeans/Eclipse builds it correctly without any error.
I am the prompt where class files have been generated for the project(Def for netbeans)
and frm cmd
prjct/class>java traceroute.java 0 localhost

and then the error pops up.
Any solutions.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try what I suggested? I'm pretty sure that is the solution.
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya got it.Thanks.I am working around other issues.Thanks for your help.

More doubts on the ways,I know you will help me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic