Source Code : This server retrieves the time using the RFC867 protocol.

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

This server retrieves the time using the RFC867 protocol.

This server retrieves the time using the RFC867 protocol.
  
/*
Chapter 3 - Simple Protocols
Java 2 Network Protocols Black Book
by Al Williams    
Paraglyph Press 2001
*/



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

public class Time867 {
    public static void main(String[] args) {
        String hostname = "tock.usno.navy.mil";
        if (args.length==1) hostname=args[0];
        try {
        int c;
        Socket sock=new Socket(hostname,13);
        InputStream is = sock.getInputStream();
        do {
          c=is.read();
          if (c!=-1) System.out.print((char)c);
           } while (c!=-1);
        }
        catch (IOException e) { System.out.println(e); }
    }
}
           
         
    
  

Thank with us