DatagramSocket isClosed() Example

Returns whether the socket is closed or not.


DatagramSocketclass isClosed() method example. This example shows you how to use isClosed() method.This method Returns whether the socket is closed or not.

Here is the code:-

/**
 * @Program that Returns whether the socket is closed or not.
 * IsClosed.java 
 * Author:-RoseIndia Team
 * Date:-20-jun-2008
 */
import java.net.*;

public class IsClosed {

    public static void main(String[] argsthrows Exception {
        DatagramSocket ds = new DatagramSocket();
        ds.connect(new InetSocketAddress(9090));
        System.out.println("The socket is closed :" + ds.isClosed());
    }
}

Output of the program:-
 The socket is closed :false

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

HOME | COPYRIGHT | CONTACT US