Example usage for org.apache.commons.net.daytime DaytimeTCPClient getTime

List of usage examples for org.apache.commons.net.daytime DaytimeTCPClient getTime

Introduction

In this page you can find the example usage for org.apache.commons.net.daytime DaytimeTCPClient getTime.

Prototype

public String getTime() throws IOException 

Source Link

Document

Retrieves the time string from the server and returns it.

Usage

From source file:examples.daytime.java

public static final void daytimeTCP(String host) throws IOException {
    DaytimeTCPClient client = new DaytimeTCPClient();

    // We want to timeout if a response takes longer than 60 seconds
    client.setDefaultTimeout(60000);/*  www.  jav a  2 s  .co  m*/
    client.connect(host);
    System.out.println(client.getTime().trim());
    client.disconnect();
}