本文整理了Java中java.net.ServerSocket.checkOpen()
方法的一些代码示例,展示了ServerSocket.checkOpen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServerSocket.checkOpen()
方法的具体详情如下:
包路径:java.net.ServerSocket
类名称:ServerSocket
方法名:checkOpen
暂无
代码示例来源:origin: robovm/robovm
/**
* Gets the socket {@link SocketOptions#SO_TIMEOUT accept timeout}.
*
* @throws IOException
* if the option cannot be retrieved.
*/
public synchronized int getSoTimeout() throws IOException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
}
代码示例来源:origin: robovm/robovm
/**
* Gets the value of the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @return {@code true} if the option is enabled, {@code false} otherwise.
* @throws SocketException
* if an error occurs while reading the option value.
*/
public boolean getReuseAddress() throws SocketException {
checkOpen();
return ((Boolean) impl.getOption(SocketOptions.SO_REUSEADDR)).booleanValue();
}
代码示例来源:origin: robovm/robovm
/**
* Sets this socket's {@link SocketOptions#SO_SNDBUF receive buffer size}.
*/
public void setReceiveBufferSize(int size) throws SocketException {
checkOpen();
if (size < 1) {
throw new IllegalArgumentException("size < 1");
}
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
}
代码示例来源:origin: robovm/robovm
/**
* Sets the value for the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @param reuse
* the socket option setting.
* @throws SocketException
* if an error occurs while setting the option value.
*/
public void setReuseAddress(boolean reuse) throws SocketException {
checkOpen();
impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(reuse));
}
代码示例来源:origin: robovm/robovm
/**
* Returns this socket's {@link SocketOptions#SO_RCVBUF receive buffer size}.
*/
public int getReceiveBufferSize() throws SocketException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
}
代码示例来源:origin: robovm/robovm
/**
* Sets the {@link SocketOptions#SO_TIMEOUT accept timeout} in milliseconds for this socket.
* This accept timeout defines the period the socket will block waiting to
* accept a connection before throwing an {@code InterruptedIOException}. The value
* {@code 0} (default) is used to set an infinite timeout. To have effect
* this option must be set before the blocking method was called.
*
* @param timeout the timeout in milliseconds or 0 for no timeout.
* @throws SocketException
* if an error occurs while setting the option.
*/
public synchronized void setSoTimeout(int timeout) throws SocketException {
checkOpen();
if (timeout < 0) {
throw new IllegalArgumentException("timeout < 0");
}
impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
}
代码示例来源:origin: robovm/robovm
/**
* Waits for an incoming request and blocks until the connection is opened.
* This method returns a socket object representing the just opened
* connection.
*
* @return the connection representing socket.
* @throws IOException
* if an error occurs while accepting a new connection.
*/
public Socket accept() throws IOException {
checkOpen();
if (!isBound()) {
throw new SocketException("Socket is not bound");
}
Socket aSocket = new Socket();
try {
implAccept(aSocket);
} catch (IOException e) {
aSocket.close();
throw e;
}
return aSocket;
}
代码示例来源:origin: robovm/robovm
checkOpen();
if (isBound()) {
throw new BindException("Socket is already bound");
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Sets the value for the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @param reuse
* the socket option setting.
* @throws SocketException
* if an error occurs while setting the option value.
*/
public void setReuseAddress(boolean reuse) throws SocketException {
checkOpen();
impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(reuse));
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Gets the socket {@link SocketOptions#SO_TIMEOUT accept timeout}.
*
* @throws IOException
* if the option cannot be retrieved.
*/
public synchronized int getSoTimeout() throws IOException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_TIMEOUT)).intValue();
}
代码示例来源:origin: MobiVM/robovm
/**
* Sets this socket's {@link SocketOptions#SO_SNDBUF receive buffer size}.
*/
public void setReceiveBufferSize(int size) throws SocketException {
checkOpen();
if (size < 1) {
throw new IllegalArgumentException("size < 1");
}
impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns this socket's {@link SocketOptions#SO_RCVBUF receive buffer size}.
*/
public int getReceiveBufferSize() throws SocketException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
}
代码示例来源:origin: ibinti/bugvm
/**
* Sets the value for the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @param reuse
* the socket option setting.
* @throws SocketException
* if an error occurs while setting the option value.
*/
public void setReuseAddress(boolean reuse) throws SocketException {
checkOpen();
impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(reuse));
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Gets the value of the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @return {@code true} if the option is enabled, {@code false} otherwise.
* @throws SocketException
* if an error occurs while reading the option value.
*/
public boolean getReuseAddress() throws SocketException {
checkOpen();
return ((Boolean) impl.getOption(SocketOptions.SO_REUSEADDR)).booleanValue();
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Sets the value for the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @param reuse
* the socket option setting.
* @throws SocketException
* if an error occurs while setting the option value.
*/
public void setReuseAddress(boolean reuse) throws SocketException {
checkOpen();
impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(reuse));
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Gets the value of the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @return {@code true} if the option is enabled, {@code false} otherwise.
* @throws SocketException
* if an error occurs while reading the option value.
*/
public boolean getReuseAddress() throws SocketException {
checkOpen();
return ((Boolean) impl.getOption(SocketOptions.SO_REUSEADDR)).booleanValue();
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns this socket's {@link SocketOptions#SO_RCVBUF receive buffer size}.
*/
public int getReceiveBufferSize() throws SocketException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Returns this socket's {@link SocketOptions#SO_RCVBUF receive buffer size}.
*/
public int getReceiveBufferSize() throws SocketException {
checkOpen();
return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
}
代码示例来源:origin: MobiVM/robovm
/**
* Sets the value for the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @param reuse
* the socket option setting.
* @throws SocketException
* if an error occurs while setting the option value.
*/
public void setReuseAddress(boolean reuse) throws SocketException {
checkOpen();
impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(reuse));
}
代码示例来源:origin: ibinti/bugvm
/**
* Gets the value of the socket option {@code SocketOptions.SO_REUSEADDR}.
*
* @return {@code true} if the option is enabled, {@code false} otherwise.
* @throws SocketException
* if an error occurs while reading the option value.
*/
public boolean getReuseAddress() throws SocketException {
checkOpen();
return ((Boolean) impl.getOption(SocketOptions.SO_REUSEADDR)).booleanValue();
}
内容来源于网络,如有侵权,请联系作者删除!