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

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

Introduction

In this page you can find the example usage for org.apache.commons.net TimeUDPClient 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 timeUDP(String host) throws IOException {
    TimeUDPClient client = new TimeUDPClient();

    // We want to timeout if a response takes longer than 60 seconds
    client.setDefaultTimeout(60000);
    client.open();//from  ww  w.j av  a  2s .c  o  m
    System.out.println(client.getDate(InetAddress.getByName(host)).toString());
    client.close();
}