Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2005, 02:24 AM
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nakulmadaan
Default Tracert

i am trying to interrogate root DNS servers, using " TRACERT " but after going to first hop i am getting " Request timed out "

please help. :)

code is as follows




import java.net.*;
import java.io.*;

class Whois extends Thread
{
 public String traceCmdUnix = "tracert -h 10 ;
 private StringBuffer result = null;


  private void pingCmd (String command)
 {
  result = new StringBuffer ();
  try {
   Process p;
   p = Runtime.getRuntime().exec(command);
   readResult(p.getInputStream());
   p.destroy();
  }
  catch (Exception e) {
    e.printStackTrace();
  }
 }

 private void readResult (InputStream in)
 {
  String line = null;
  BufferedReader br = new BufferedReader(new InputStreamReader(in));
  try {

   while (!this.isInterrupted() &&
    (line = br.readLine()) != null)
   {
    //this.doResultLine(line+"\n");
    System.out.println(line);
   }
  }
  catch (IOException e) {
    e.printStackTrace();
  }
  finally {
   try {
    br.close();
   }
   catch (IOException e) {
   }
  }
  if (this.isInterrupted())
   System.out.println("*** Canceld ***");
 }
  public static void main (String args[]) throws Exception
  {
   Whois MyObj = new Whois();
   MyObj.traceCmdUnix = MyObj.traceCmdUnix + " " + "www.yahoo.com" ;
   MyObj.pingCmd(MyObj.traceCmdUnix);
  }


}


OUTPUT:----->
C:\>tracert -d 5 -w 600 www.yahoo.com

Tracing route to www.yahoo.akadns.net [68.142.226.39]
over a maximum of 30 hops:

  1 <10 ms <10 ms <10 ms 10.129.210.100
  2 * * * Request timed out.
  3 * * * Request timed out.
  4 * * * Request timed out.
  5 * * * Request timed out.
  6 * * * Request timed out.
  7 * * * Request timed out.
  8 * * * Request timed out.
  9 * * * Request timed out.
 10 * * * Request timed out.

plz help

Thanks :)

 
Old March 16th, 2005, 11:37 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

can you normally run tracert from your line - some ISPs && firewalls drop these packets, which would be consistent with this behaviour.

I noticed you're missing a closing quote after the definition of traceCmdUnix, but I guess that's a cut && paste error.

I just tried this code on a debian linux box running jdk1.5, and it works fine, after changing traceCmdUnix to "traceroute "

--
# java -cp . Whois
 1 192.168.1.2 (192.168.1.2) 0.957 ms 1.016 ms 0.796 ms
 2 poptelhg2.ilford.broadband.bt.net (217.32.101.17) 19.990 ms 83.415 ms 18.891 ms
 3 gateway.telecity-1.getrealnet.net (212.90.32.7) 260.365 ms 229.023 ms 255.511 ms
 4 fe-0-0.lon4gw2.uk.insnet.net (194.205.217.65) 19.536 ms 19.911 ms 20.351 ms
 5 ge-6-2-0.icr2.lon4.adm.uk.cw.net (213.38.239.131) 23.632 ms 18.704 ms 22.865 ms
 6 ge-0-0-0.itr1.lon4.adm.uk.cw.net (213.38.239.84) 27.743 ms 23.823 ms 18.736 ms
 7 so-0-3-0-bcr1.tsd.cw.net (166.63.211.197) 19.864 ms 21.882 ms 19.919 ms
 8 so-1-1-0-dcr1.tsd.cw.net (195.2.10.98) 19.856 ms 25.450 ms 19.201 ms
 9 so-5-0-0-dcr1.nyk.cw.net (195.2.10.113) 95.453 ms 91.227 ms 91.300 ms
10 so-0-0-0-ecr1.nyk.cw.net (195.2.3.14) 94.952 ms 173.521 ms 92.009 ms
11 bas1-m.nyc.yahoo.com (198.32.118.24) 310.020 ms 204.963 ms 223.930 ms
12 ge-2-0-9.p558.pat1.dce.yahoo.com (216.115.97.17) 113.191 ms 113.142 ms 112.400 ms
13 vlan200-msr1.dcn.yahoo.com (216.115.96.161) 114.874 ms ae1.p400.msr1.dcn.yahoo.com (216.115.96.181) 111.907 ms vlan200-msr1.dcn.yahoo.com (216.115.96.161) 111.740 ms
14 ge7-1.bas2-m.dcn.yahoo.com (216.109.120.207) 113.635 ms ge2-2.bas1-m.dcn.yahoo.com (216.109.120.142) 110.511 ms ge3-1.bas2-m.dcn.yahoo.com (216.109.120.146) 117.555 ms
15 p12.www.dcn.yahoo.com (216.109.118.75) 113.680 ms 112.480 ms 116.289 ms

#
--

So I am definitely guessing you're filtering ICMP traffic at your firewall or at your ISP.

HTH




--
Don't Stand on your head - you'll get footprints in your hair. http://www.charlieharvey.org.uk








Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.