diff options
Diffstat (limited to 'libjava/classpath/compat/java.net/GetSocketOptionInfo.java')
-rw-r--r-- | libjava/classpath/compat/java.net/GetSocketOptionInfo.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libjava/classpath/compat/java.net/GetSocketOptionInfo.java b/libjava/classpath/compat/java.net/GetSocketOptionInfo.java new file mode 100644 index 0000000..1a5f351 --- /dev/null +++ b/libjava/classpath/compat/java.net/GetSocketOptionInfo.java @@ -0,0 +1,39 @@ +// Class to identify socket option constants. + +import java.io.*; +import java.net.*; + +public class GetSocketOptionInfo extends Socket implements SocketImplFactory +{ + +public SocketImpl +createSocketImpl() +{ + return(new PlainSocketImpl()); +} + +public static void +main(String[] argv) throws IOException +{ + Socket.setSocketImplFactory(new GetSocketOptionInfo()); + + Socket s = new Socket(); + + System.err.println("Setting TCP_NODELAY on"); + s.setTcpNoDelay(true); + System.err.println("Setting TCP_NODELAY off"); + s.setTcpNoDelay(false); + + System.err.println("Setting SO_LINGER on"); + s.setSoLinger(true, 10); + System.err.println("Setting SO_LINGER off"); + s.setSoLinger(false, 1); + + System.err.println("Setting SO_TIMEOUT to 15"); + s.setSoTimeout(15); + System.err.println("Setting SO_TIMEOUT to 0"); + s.setSoTimeout(0); +} + +} + |