Example usage for org.apache.commons.net TimeTCPClient setDefaultTimeout

List of usage examples for org.apache.commons.net TimeTCPClient setDefaultTimeout

Introduction

In this page you can find the example usage for org.apache.commons.net TimeTCPClient setDefaultTimeout.

Prototype

public void setDefaultTimeout(int timeout) 

Source Link

Document

Set the default timeout in milliseconds to use when opening a socket.

Usage

From source file:examples.rdate.java

public static final void timeTCP(String host) throws IOException {
    TimeTCPClient client = new TimeTCPClient();

    // We want to timeout if a response takes longer than 60 seconds
    client.setDefaultTimeout(60000);
    client.connect(host);//w  ww.j  av a  2 s .  c  om
    System.out.println(client.getDate().toString());
    client.disconnect();
}