Code example for Socket

Methods: isBoundisClosedisConnectedisInputShutdownisOutputShutdown

     * Returns true if the Socket is still alive. 
     * @return true if the Socket is still alive 
    private boolean isSocketLive() { 
        return (socket.isBound() &&
                !socket.isClosed() && socket.isConnected() &&
                !socket.isInputShutdown() && !socket.isOutputShutdown());
     * Read a line of text. A line is considered to be terminated  
     * by any one of a line feed ('\n'), a carriage return ('\r'), 
     * or a carriage return followed immediately by a linefeed.  
     * @return A String containing the contents of the line,  
     * not including any line-termination 
     * characters, or null if the end of the stream has been reached 
     * @throws IOException if an I/O error occurs