ServerSocket IsBound() Example

Started by VelMurugan, Jan 06, 2009, 07:05 AM

Previous topic - Next topic

VelMurugan

ServerSocket IsBound() Example

Returns the binding state of the ServerSocket.

ServerSocketclass IsBound() method example. This example shows you how to use IsBound() method.This method Returns the binding state of the ServerSocket.

Here is the code:-

/**
* @Program that Returns the binding state of the ServerSocket.
* IsBound.java
* Author:-RoseIndia Team
* Date:-21-jun-2008
*/
import java.net.*;

public class IsBound {

    public static void main(String[] args) throws Exception {
        InetAddress i = InetAddress.getByName("girish-desktop");
        ServerSocket ss = new ServerSocket(8080, 1, i);
        //Returns the binding state of the ServerSocket.
        System.out.println("Binding state of the ServerSocket is: " + ss.isBound());
    }
}


Output of the program:-

Binding state of the ServerSocket is: true

Source : codingdiary