DatagramSocket GetReuseAddress() Example

Tests if SO_REUSEADDR is enabled.


DatagramSocketclass GetReuseAddress() method example. This example shows you how to use GetReuseAddress() method.This method Tests if SO_REUSEADDR is enabled.

Here is the code:-

/**
 * @Program that Tests if SO_REUSEADDR is enabled.
 * GetReuseAddress.java 
 * Author:-RoseIndia Team
 * Date:-20-jun-2008
 */
import java.net.*;

public class GetReuseAddress {

    public static void main(String[] argsthrows Exception {
        DatagramSocket ds = new DatagramSocket();
        ds.connect(new InetSocketAddress(9090));
        //Tests if SO_REUSEADDR is enabled.
        System.out.println("REUSEADDR is enabled: " + ds.getReuseAddress());

    }
}

Output of the program:-
 REUSEADDR is enabled: false

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US