Socket isOutputShutdown Example

Started by VelMurugan, Jan 06, 2009, 08:01 AM

Previous topic - Next topic

VelMurugan

Socket isOutputShutdown Example

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

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

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

import java.net.*;

public class IsOutputShutdown {

    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));

        System.out.println("read-half of the socket connection is closed.  " +
                socket.isOutputShutdown());
        socket.close();
    }
}


Output

read-half of the socket connection is closed. false

Source : codingdiary