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

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

Introduction

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

Prototype

public void connect(InetAddress host) throws SocketException, IOException 

Source Link

Document

Opens a Socket connected to a remote host at the current default port and originating from the current host at a system assigned port.

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);//from w  w  w. j ava 2  s .c o m
    client.connect(host);
    System.out.println(client.getTime().trim());
    client.disconnect();
}