我才看到用JAVA实现这个功能的
http://www.chinajavaworld.com/进最上边的“JAVA例程/用JAVA程序取得IP地址”就可以看到了 快去吧

解决方案 »

  1.   

    应该是可以实现的,可惜我现在放假回家了,否则就可以贴篇文章给你看看,pity.....。
      

  2.   

    import java.io.*;
    import java.net.InetAddress;
    .........    String s;
        try {
          while((s = in.readLine()).length() != 0)
            try{
              InetAddress ip=InetAddress.getByName(s);
              System.out.println(s+"=="+ip.toString()+" host name="+ip.getHostName()+" path name="+ip.getHostName());
             
            }catch(Exception e){System.out.println(s+" is 连接不上");}
            
        } catch(IOException e) {
          e.printStackTrace();
        }
      

  3.   

    以下是我的测试结果,当某个ip不存在或者ping不通时显示连接不上:
    11.14.192.49==playgirl/11.14.192.49 host name=playgirl path name=playgirl
    11.14.192.141==11.14.192.141/11.14.192.141 host name=11.14.192.141 path name=11.14.192.141
    11.14.192.143 is 连接不上
    11.14.192.145==playboy/11.14.192.145 host name=playboy path name=playboy
      

  4.   

    我测试和你一样。
    import java.io.*;
    import java.net.*;public class PseudoPing {
      public static void main(String args[]) {
        try {
          Socket t = new Socket(args[0], 7);
          DataInputStream dis = new DataInputStream(t.getInputStream());
          PrintStream ps = new PrintStream(t.getOutputStream());
          ps.println("Hello");
          String str = dis.readLine();
          if (str.equals("Hello"))
            System.out.println("Alive!") ;
          else
            System.out.println("Dead or echo port not responding");              
          t.close();
          }
        catch (IOException e) {
          e.printStackTrace();}
          }
          }
    但只能测出具有Http、Ftp等服务的机器,
      

  5.   

    你按照我的试试看是否只能测出具有Http、Ftp等服务的机器!因为我们这边很多都是me或2000的所以我也策不了没有具有Http、Ftp等服务的机器
      

  6.   

    你可以用这个试试:     try {
                                    Process process = Runtime.getRuntime().exec("ping 172.17.60.45");
                    String output;               
                    BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); 
                                    while ( (output=bufferedReader.readLine()) != null)
                                    out.println(output);                 
               }
              catch (Exception e){    out.println("<b>Wrong selection : </b>" + e.toString());    }
      

  7.   

    下面程序和ping功能差不多,甚至比ping还要好,
    你先编译 然后 java InetAddressTest +ip地址或机器名
    /**
     * @version 1.00 1999-08-28
     * @author Cay Horstmann
     */import java.net.*;public class InetAddressTest
    {  public static void main(String[] args)
       {  try
          {
             if (args.length > 0)
             {  String host = args[0];
                InetAddress[] addresses
                   = InetAddress.getAllByName(host);
                for (int i = 0; i < addresses.length; i++)
                   System.out.println(addresses[i]);
             }
             else
             {  InetAddress localHostAddress
                   = InetAddress.getLocalHost();
                System.out.println(localHostAddress);
             }
          }
          catch (Exception e)
          {  System.out.println("Error: " + e);
          }
       }
    } 试试
      

  8.   

    TO:tiangou(分数不多就去灌水乐园) 
    请问路由器可用您的程序测试吗?