本文整理汇总了Java中java.net.Socket.setOOBInline方法的典型用法代码示例。如果您正苦于以下问题:Java Socket.setOOBInline方法的具体用法?Java Socket.setOOBInline怎么用?Java Socket.setOOBInline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.Socket
的用法示例。
在下文中一共展示了Socket.setOOBInline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProperties
import java.net.Socket; //导入方法依赖的package包/类
public void setProperties(Socket socket) throws SocketException{
if (rxBufSize != null)
socket.setReceiveBufferSize(rxBufSize.intValue());
if (txBufSize != null)
socket.setSendBufferSize(txBufSize.intValue());
if (ooBInline !=null)
socket.setOOBInline(ooBInline.booleanValue());
if (soKeepAlive != null)
socket.setKeepAlive(soKeepAlive.booleanValue());
if (performanceConnectionTime != null && performanceLatency != null &&
performanceBandwidth != null)
socket.setPerformancePreferences(
performanceConnectionTime.intValue(),
performanceLatency.intValue(),
performanceBandwidth.intValue());
if (soReuseAddress != null)
socket.setReuseAddress(soReuseAddress.booleanValue());
if (soLingerOn != null && soLingerTime != null)
socket.setSoLinger(soLingerOn.booleanValue(),
soLingerTime.intValue());
if (soTimeout != null && soTimeout.intValue() >= 0)
socket.setSoTimeout(soTimeout.intValue());
if (tcpNoDelay != null)
socket.setTcpNoDelay(tcpNoDelay.booleanValue());
}
示例2: setProperties
import java.net.Socket; //导入方法依赖的package包/类
public void setProperties(Socket socket) throws SocketException {
if (rxBufSize != null)
socket.setReceiveBufferSize(rxBufSize.intValue());
if (txBufSize != null)
socket.setSendBufferSize(txBufSize.intValue());
if (ooBInline != null)
socket.setOOBInline(ooBInline.booleanValue());
if (soKeepAlive != null)
socket.setKeepAlive(soKeepAlive.booleanValue());
if (performanceConnectionTime != null && performanceLatency != null && performanceBandwidth != null)
socket.setPerformancePreferences(performanceConnectionTime.intValue(), performanceLatency.intValue(),
performanceBandwidth.intValue());
if (soReuseAddress != null)
socket.setReuseAddress(soReuseAddress.booleanValue());
if (soLingerOn != null && soLingerTime != null)
socket.setSoLinger(soLingerOn.booleanValue(), soLingerTime.intValue());
if (soTimeout != null && soTimeout.intValue() >= 0)
socket.setSoTimeout(soTimeout.intValue());
if (tcpNoDelay != null)
socket.setTcpNoDelay(tcpNoDelay.booleanValue());
}
示例3: listen
import java.net.Socket; //导入方法依赖的package包/类
public void listen() throws Exception {
if (doListen()) {
log.warn("ServerSocket already started");
return;
}
setListen(true);
while ( doListen() ) {
Socket socket = null;
if ( getTaskPool().available() < 1 ) {
if ( log.isWarnEnabled() )
log.warn("All BIO server replication threads are busy, unable to handle more requests until a thread is freed up.");
}
BioReplicationTask task = (BioReplicationTask)getTaskPool().getRxTask();
if ( task == null ) continue; //should never happen
try {
socket = serverSocket.accept();
}catch ( Exception x ) {
if ( doListen() ) throw x;
}
if ( !doListen() ) {
task.setDoRun(false);
task.serviceSocket(null,null);
getExecutor().execute(task);
break; //regular shutdown
}
if ( socket == null ) continue;
socket.setReceiveBufferSize(getRxBufSize());
socket.setSendBufferSize(getTxBufSize());
socket.setTcpNoDelay(getTcpNoDelay());
socket.setKeepAlive(getSoKeepAlive());
socket.setOOBInline(getOoBInline());
socket.setReuseAddress(getSoReuseAddress());
socket.setSoLinger(getSoLingerOn(),getSoLingerTime());
socket.setSoTimeout(getTimeout());
ObjectReader reader = new ObjectReader(socket);
task.serviceSocket(socket,reader);
getExecutor().execute(task);
}//while
}
示例4: openSocket
import java.net.Socket; //导入方法依赖的package包/类
/**
* open real socket and set time out when waitForAck is enabled
* is socket open return directly
*/
protected void openSocket() throws IOException {
if(isConnected()) return ;
try {
socket = new Socket();
InetSocketAddress sockaddr = new InetSocketAddress(getAddress(), getPort());
socket.connect(sockaddr,(int)getTimeout());
socket.setSendBufferSize(getTxBufSize());
socket.setReceiveBufferSize(getRxBufSize());
socket.setSoTimeout( (int) getTimeout());
socket.setTcpNoDelay(getTcpNoDelay());
socket.setKeepAlive(getSoKeepAlive());
socket.setReuseAddress(getSoReuseAddress());
socket.setOOBInline(getOoBInline());
socket.setSoLinger(getSoLingerOn(),getSoLingerTime());
socket.setTrafficClass(getSoTrafficClass());
setConnected(true);
soOut = socket.getOutputStream();
soIn = socket.getInputStream();
setRequestCount(0);
setConnectTime(System.currentTimeMillis());
if (log.isDebugEnabled())
log.debug(sm.getString("IDataSender.openSocket", getAddress().getHostAddress(), Integer.valueOf(getPort()), Long.valueOf(0)));
} catch (IOException ex1) {
SenderState.getSenderState(getDestination()).setSuspect();
if (log.isDebugEnabled())
log.debug(sm.getString("IDataSender.openSocket.failure",getAddress().getHostAddress(), Integer.valueOf(getPort()), Long.valueOf(0)), ex1);
throw (ex1);
}
}
示例5: openSocket
import java.net.Socket; //导入方法依赖的package包/类
/**
* open real socket and set time out when waitForAck is enabled is socket
* open return directly
*/
protected void openSocket() throws IOException {
if (isConnected())
return;
try {
socket = new Socket();
InetSocketAddress sockaddr = new InetSocketAddress(getAddress(), getPort());
socket.connect(sockaddr, (int) getTimeout());
socket.setSendBufferSize(getTxBufSize());
socket.setReceiveBufferSize(getRxBufSize());
socket.setSoTimeout((int) getTimeout());
socket.setTcpNoDelay(getTcpNoDelay());
socket.setKeepAlive(getSoKeepAlive());
socket.setReuseAddress(getSoReuseAddress());
socket.setOOBInline(getOoBInline());
socket.setSoLinger(getSoLingerOn(), getSoLingerTime());
socket.setTrafficClass(getSoTrafficClass());
setConnected(true);
soOut = socket.getOutputStream();
soIn = socket.getInputStream();
setRequestCount(0);
setConnectTime(System.currentTimeMillis());
if (log.isDebugEnabled())
log.debug(sm.getString("IDataSender.openSocket", getAddress().getHostAddress(),
Integer.valueOf(getPort()), Long.valueOf(0)));
} catch (IOException ex1) {
SenderState.getSenderState(getDestination()).setSuspect();
if (log.isDebugEnabled())
log.debug(sm.getString("IDataSender.openSocket.failure", getAddress().getHostAddress(),
Integer.valueOf(getPort()), Long.valueOf(0)), ex1);
throw (ex1);
}
}
示例6: listen
import java.net.Socket; //导入方法依赖的package包/类
public void listen() throws Exception {
if (doListen()) {
log.warn("ServerSocket already started");
return;
}
setListen(true);
while (doListen()) {
Socket socket = null;
if (getTaskPool().available() < 1) {
if (log.isWarnEnabled())
log.warn(
"All BIO server replication threads are busy, unable to handle more requests until a thread is freed up.");
}
BioReplicationTask task = (BioReplicationTask) getTaskPool().getRxTask();
if (task == null)
continue; // should never happen
try {
socket = serverSocket.accept();
} catch (Exception x) {
if (doListen())
throw x;
}
if (!doListen()) {
task.setDoRun(false);
task.serviceSocket(null, null);
getExecutor().execute(task);
break; // regular shutdown
}
if (socket == null)
continue;
socket.setReceiveBufferSize(getRxBufSize());
socket.setSendBufferSize(getTxBufSize());
socket.setTcpNoDelay(getTcpNoDelay());
socket.setKeepAlive(getSoKeepAlive());
socket.setOOBInline(getOoBInline());
socket.setReuseAddress(getSoReuseAddress());
socket.setSoLinger(getSoLingerOn(), getSoLingerTime());
socket.setSoTimeout(getTimeout());
ObjectReader reader = new ObjectReader(socket);
task.serviceSocket(socket, reader);
getExecutor().execute(task);
} // while
}