ServerSocket GetReuseAddress() Example

Tests if SO_REUSEADDR is enabled.


ServerSocketclass 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:-21-jun-2008
 */
import java.net.*;

public class GetReuseAddress {

    public static void main(String[] argsthrows Exception {
        InetAddress i = InetAddress.getByName("girish-desktop");
        ServerSocket ss = new ServerSocket(80801, i);
        //Tests if SO_REUSEADDR is enabled.
        System.out.println("SO_REUSEADDR is enabled: " + ss.getReuseAddress());
    }
}

Output of the program:-
 SO_REUSEADDR is enabled: true

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

HOME | COPYRIGHT | CONTACT US