Socket getSoLinger Example

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


Socket class getSoLinger example. public int getSoLinger() throws SocketException Returns setting for SO_LINGER. -1 returns implies that the option is disabled. The setting only affects socket close.

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

import java.net.*;

public class GetSoLinger {

    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("SoLinger " + socket.getSoLinger());

        //close socket
        socket.close();
    }
}

Output
SoLinger -1

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

HOME | COPYRIGHT | CONTACT US