List of usage examples for org.apache.commons.net TimeUDPClient getDate
public Date getDate(InetAddress host) throws IOException
getTime(host, DEFAULT_PORT);
From source file:examples.rdate.java
public static final void timeUDP(String host) throws IOException { TimeUDPClient client = new TimeUDPClient(); // We want to timeout if a response takes longer than 60 seconds client.setDefaultTimeout(60000);//from ww w .j a va2 s . c o m client.open(); System.out.println(client.getDate(InetAddress.getByName(host)).toString()); client.close(); }