mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-26 05:15:51 +00:00
Initial revision
From-SVN: r102074
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user