Socket isInputShutdown Example

Socket class isInputShutdown example. This example shows you how to use isInputShutdown method.


Socket class isInputShutdown example. public boolean isInputShutdown() Returns whether the read-half of the socket connection is closed.

Here is the code
/*
 * @ # IsInputShutdown.java
 * A class repersenting use to isInputShutdown method 
 * of NumberFormat class in java.net package
 * version 21 June 2008
 * author Rose India 
 */

import java.net.*;

public class IsInputShutdown {

    public static void main(String args[]) throws Exception {

        Socket socket = new Socket();

        //Connects this socket to the server.
        socket.connect(new InetSocketAddress("192.168.10.211"8080));

        if (!socket.isInputShutdown()) {
            System.out.println("read-half of the socket connection is closed " +
                    socket.isInputShutdown());
            socket.shutdownInput();
        }
        System.out.println("read-half of the socket connection is closed.  " +
                socket.isInputShutdown());
        socket.close();
    }
}

Output
read-half of the socket connection is closed false
read-half of the socket connection is closed.  true

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

HOME | COPYRIGHT | CONTACT US