请问 Java 实现 ping 功能中的这段代码中 端口号作用是什么呢? 代码如下: http://java.sun.com/j2se/1.5.0/docs/guide/nio/example/Ping.java在命令行一定输入端口, 才可以执行. 但是在 window 中的 ping 命令根本就不用 输入端口号的. 哪上面的代码根本就没有实现 ping 功能了.我这样认为对吗? 

解决方案 »

  1.   

     * @(#)Ping.java 1.2 01/12/13
     * Connect to each of a list of hosts and measure the time required to complete
     * the connection.  This example uses a selector and two additional threads in
     * order to demonstrate non-blocking connects and the multithreaded use of a
     * selector.
      

  2.   


    如何改成类似 window 支持 IMCP 协议的 ping 命令呢?