本帖最后由 terry21 于 2011-07-18 11:15:17 编辑

解决方案 »

  1.   

    如下
    package test;import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;public class Sample {
     static BufferedReader br; public static void main(String[] args) throws IOException {
      try {
       // Process process = Runtime.getRuntime().exec("www.baidu.com");//是否连接的IP;
       Process process = Runtime.getRuntime().exec("ping 192.168.1.116");// 是否连接的IP;
       br = new BufferedReader(new InputStreamReader(process
         .getInputStream()));
       String connectionStr = "";
       while ((connectionStr = br.readLine()) != null) {
        System.out.println(connectionStr);
       }
      } catch (IOException e) {
       e.printStackTrace();
      } finally {
       br.close();
      }
     }
    }
      

  2.   

    socket连哈看看,能连上说明端口开了,否则没有开。
    一般你可把常用的端口列出来扫,否则遍历一个一个太慢了。
      

  3.   

    HeiBoyYang 的只能看这台机器ping的通否,不能知道机器开了那些端口。“怎样用java查看远程服务器数据库表空间使用情况?” 就类似一个数据库的客户端。用jdbc连上去,然后根据具体不同的数据库会提供不同的查询方法。 具体请google哈,或其他同志们补上。