本文整理了Java中java.net.Socket.setTrafficClass()
方法的一些代码示例,展示了Socket.setTrafficClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Socket.setTrafficClass()
方法的具体详情如下:
包路径:java.net.Socket
类名称:Socket
方法名:setTrafficClass
[英]Sets this socket's SocketOptions#IP_TOS value for every packet sent by this socket.
[中]为该套接字发送的每个数据包设置该套接字的SocketOptions#IP_TOS值。
代码示例来源:origin: aws/aws-sdk-java
@Override
public void setTrafficClass(int tc) throws SocketException {
sock.setTrafficClass(tc);
}
代码示例来源:origin: netty/netty
@Override
public SocketChannelConfig setTrafficClass(int trafficClass) {
try {
javaSocket.setTrafficClass(trafficClass);
} catch (SocketException e) {
throw new ChannelException(e);
}
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public SocketChannelConfig setTrafficClass(int trafficClass) {
try {
javaSocket.setTrafficClass(trafficClass);
} catch (SocketException e) {
throw new ChannelException(e);
}
return this;
}
代码示例来源:origin: apache/zookeeper
/**
* See {@link Socket#setTrafficClass(int)}. Calling this method does not trigger mode detection.
*/
@Override
public void setTrafficClass(int tc) throws SocketException {
getSocketAllowUnknownMode().setTrafficClass(tc);
}
代码示例来源:origin: libgdx/libgdx
private void applyHints (SocketHints hints) {
if (hints != null) {
try {
socket.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
hints.performancePrefBandwidth);
socket.setTrafficClass(hints.trafficClass);
socket.setTcpNoDelay(hints.tcpNoDelay);
socket.setKeepAlive(hints.keepAlive);
socket.setSendBufferSize(hints.sendBufferSize);
socket.setReceiveBufferSize(hints.receiveBufferSize);
socket.setSoLinger(hints.linger, hints.lingerDuration);
socket.setSoTimeout(hints.socketTimeout);
} catch (Exception e) {
throw new GdxRuntimeException("Error setting socket hints.", e);
}
}
}
代码示例来源:origin: libgdx/libgdx
private void applyHints (SocketHints hints) {
if (hints != null) {
try {
socket.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
hints.performancePrefBandwidth);
socket.setTrafficClass(hints.trafficClass);
socket.setTcpNoDelay(hints.tcpNoDelay);
socket.setKeepAlive(hints.keepAlive);
socket.setSendBufferSize(hints.sendBufferSize);
socket.setReceiveBufferSize(hints.receiveBufferSize);
socket.setSoLinger(hints.linger, hints.lingerDuration);
socket.setSoTimeout(hints.socketTimeout);
} catch (Exception e) {
throw new GdxRuntimeException("Error setting socket hints.", e);
}
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public SocketChannelConfig setTrafficClass(int trafficClass) {
try {
javaSocket.setTrafficClass(trafficClass);
} catch (SocketException e) {
throw new ChannelException(e);
}
return this;
}
代码示例来源:origin: io.netty/netty
public void setTrafficClass(int trafficClass) {
try {
socket.setTrafficClass(trafficClass);
} catch (SocketException e) {
throw new ChannelException(e);
}
}
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("tc"))
public Memory setTrafficClass(Environment env, Memory... args) throws SocketException {
socket.setTrafficClass(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: apache/activemq
sock.setTrafficClass(this.trafficClass);
代码示例来源:origin: alibaba/cobar
socket.setTrafficClass(0x04 | 0x10);
socket.setPerformancePreferences(0, 2, 1);
socket.setReceiveBufferSize(RECV_BUFFER_SIZE);
代码示例来源:origin: wildfly/wildfly
} else if (option == Options.IP_TRAFFIC_CLASS) {
result = option.cast(Integer.valueOf(conduit.getSocketChannel().socket().getTrafficClass()));
conduit.getSocketChannel().socket().setTrafficClass(Options.IP_TRAFFIC_CLASS.cast(value).intValue());
} else if (option == Options.KEEP_ALIVE) {
result = option.cast(Boolean.valueOf(conduit.getSocketChannel().socket().getKeepAlive()));
代码示例来源:origin: apache/nifi
socket.setTrafficClass(config.getTrafficClass());
代码示例来源:origin: org.apache.hadoop/hadoop-common
this.socket.setTrafficClass(0x04 | 0x10);
this.socket.setPerformancePreferences(1, 2, 0);
代码示例来源:origin: ltsopensource/light-task-scheduler
socketChannel.socket().setTrafficClass(serverConfig.getIpTos());
代码示例来源:origin: ltsopensource/light-task-scheduler
socketChannel.socket().setTrafficClass(serverConfig.getIpTos());
代码示例来源:origin: ltsopensource/light-task-scheduler
socketChannel.socket().setTrafficClass(clientConfig.getIpTos());
代码示例来源:origin: ltsopensource/light-task-scheduler
socketChannel.socket().setTrafficClass(clientConfig.getIpTos());
代码示例来源:origin: wildfly/wildfly
if (optionMap.contains(Options.TCP_OOB_INLINE)) channel.socket().setOOBInline(optionMap.get(Options.TCP_OOB_INLINE, false));
if (optionMap.contains(Options.TCP_NODELAY)) channel.socket().setTcpNoDelay(optionMap.get(Options.TCP_NODELAY, false));
if (optionMap.contains(Options.IP_TRAFFIC_CLASS)) channel.socket().setTrafficClass(optionMap.get(Options.IP_TRAFFIC_CLASS, -1));
if (optionMap.contains(Options.CLOSE_ABORT)) channel.socket().setSoLinger(optionMap.get(Options.CLOSE_ABORT, false), 0);
if (optionMap.contains(Options.KEEP_ALIVE)) channel.socket().setKeepAlive(optionMap.get(Options.KEEP_ALIVE, false));
代码示例来源:origin: wildfly/wildfly
if (optionMap.contains(Options.TCP_OOB_INLINE)) channel.socket().setOOBInline(optionMap.get(Options.TCP_OOB_INLINE, false));
if (optionMap.contains(Options.TCP_NODELAY)) channel.socket().setTcpNoDelay(optionMap.get(Options.TCP_NODELAY, false));
if (optionMap.contains(Options.IP_TRAFFIC_CLASS)) channel.socket().setTrafficClass(optionMap.get(Options.IP_TRAFFIC_CLASS, -1));
if (optionMap.contains(Options.CLOSE_ABORT)) channel.socket().setSoLinger(optionMap.get(Options.CLOSE_ABORT, false), 0);
if (optionMap.contains(Options.KEEP_ALIVE)) channel.socket().setKeepAlive(optionMap.get(Options.KEEP_ALIVE, false));
内容来源于网络,如有侵权,请联系作者删除!