Example usage for java.net Socket getReuseAddress

List of usage examples for java.net Socket getReuseAddress

Introduction

In this page you can find the example usage for java.net Socket getReuseAddress.

Prototype

public boolean getReuseAddress() throws SocketException 

Source Link

Document

Tests if SocketOptions#SO_REUSEADDR SO_REUSEADDR is enabled.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Socket client = new Socket("google.com", 80);
    client.setReuseAddress(true);/*from  ww w .  jav  a2  s  . c o m*/
    System.out.println(client.getReuseAddress());

    client.close();
}