📄 timeoutdemo.java
字号:
//【代码18-1-1】
//TimeOutDemo.java
import java.net.*;
class TimeOutDemo
{
public static void main(String[] args)
{
SocketImpl impl = new MyPlainSocketImpl();
try
{
//
// Set time-out of 1 sec
impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(1000));
// Read it back
int timeout =((Integer)impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
//
}
catch (java.io.IOException e)
{
System.out.println(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -