aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes TimeClient class that uses Time protocol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "TimeClient class that uses Time protocol" Watch "TimeClient class that uses Time protocol" New topic
Author

TimeClient class that uses Time protocol

Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

I've developed this This client class that tries to connect to time protocol on port 37

but it give me this error
java.net.UnknownHostException: time.nist.gov
I'd be grateful if you can help me?
thanks in advance..........................

I Hear I Forget, I See I Remember, I Do I Understand.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Have you tried any other servers, like the ones listed in http://tf.nist.gov/tf-cgi/servers.cgi ?

Not sure if that particular server usually responds to ping, but right now it doesn't.


Ping & DNS - updated with new look and Ping home screen widget
Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

Thanks Ulf Dittmer for your valuable help, I've tried another server and it works well but I have one question concerning this code:
Can you explain to me what this line do???
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
It looks like the server returns the seconds since the epoch (1.1.1970) as a 4-byte value. That's actually all the server returns according to the RFC that specifies the time protocol.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimeClient class that uses Time protocol
 
Similar Threads
Client/server/JDBC
Identifying the COM,LPT ports in WIndows OS thru Java COMM API
Need help with thread pool issue..
Can't catch Window Close event when trying SocketServer trying to accept connections
Echo client/server application