Socket getTcpNoDelay Example
Socket class getTcpNoDelay example. This example shows you how to use getTcpNoDelay method.
Socket class getTcpNoDelay example. public boolean getTcpNoDelay() throws SocketException Tests if TCP_NODELAY is enabled.
Here is the code
/*
* @ # GetTcpNoDelay.java
* A class repersenting use to TcpNoDelay method
* of NumberFormat class in java.text package
* version 17 June 2008
* author Rose India
*/
import java.net.*;
public class GetTcpNoDelay {
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.getTcpNoDelay()) {
socket.setTcpNoDelay(true);
}
System.out.println("TcpNoDelay " + socket.getTcpNoDelay());
//close socket
socket.close();
}
} |
|