⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dayping.java

📁 java3D game engine design of the source [three-dimensionalvirtualrealitynetworkprogram] - "virtual
💻 JAVA
字号:

// DayPing.java
// Andrew Davison, June 2003, dandrew@ratree.psu.ac.th

/* Check if a server is alive by contacting (pinging) its daytime server.
  One problem is that daytime servers are not always switched on.

  A host which is on:
     time-A.timefreq.bldrdoc.gov

  For a long list, see:
    http://www.boulder.nist.gov/timefreq/service/time-servers.html

  For use through a firewall, use something like:
     java -DproxySet=true -DproxyHost=SOMEHOST -DproxyPort=SOMENUM DayPing <host>

  This is packaged up in DayPing.bat
*/


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


public class DayPing 
{
   public static void main(String args[]) throws IOException 
   {
      if (args.length != 1) {
        System.out.println("usage:  java DayPing <host> ");
        System.exit(0);
      }

      Socket sock = new Socket(args[0], 13);   // host and daytime port
      BufferedReader br = new BufferedReader( 
              new InputStreamReader( sock.getInputStream() ) );
       
      System.out.println( args[0] + " is alive at ");
      String line;
      while ( (line = br.readLine()) != null)
        System.out.println(line);

      sock.close();                      
   }

} // end of DayPing class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -