List of usage examples for io.netty.channel ChannelOption IP_TOS
ChannelOption IP_TOS
To view the source code for io.netty.channel ChannelOption IP_TOS.
Click Source Link
From source file:com.comphenix.protocol.compat.netty.independent.NettySocketAdapter.java
License:Open Source License
@Override public int getTrafficClass() throws SocketException { return ch.config().getOption(ChannelOption.IP_TOS); }
From source file:com.comphenix.protocol.compat.netty.independent.NettySocketAdapter.java
License:Open Source License
@Override public void setTrafficClass(int tc) throws SocketException { ch.config().setOption(ChannelOption.IP_TOS, tc); }
From source file:de.jackwhite20.japs.server.network.initialize.ClusterPublisherChannelInitializer.java
License:Open Source License
@Override protected void initChannel(Channel channel) throws Exception { try {//from w w w.j a va 2 s .c o m channel.config().setOption(ChannelOption.IP_TOS, 0x18); } catch (ChannelException e) { // Not supported } channel.config().setAllocator(PooledByteBufAllocator.DEFAULT); channel.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4)); channel.pipeline().addLast(new JSONObjectDecoder()); channel.pipeline().addLast(new LengthFieldPrepender(4)); channel.pipeline().addLast(new JSONObjectEncoder()); channel.pipeline().addLast(clusterPublisher); }
From source file:de.jackwhite20.japs.server.network.initialize.ServerChannelInitializer.java
License:Open Source License
@Override protected void initChannel(Channel channel) throws Exception { try {/*from w w w . j a v a2 s. com*/ channel.config().setOption(ChannelOption.IP_TOS, 0x18); } catch (ChannelException e) { // Not supported } channel.config().setAllocator(PooledByteBufAllocator.DEFAULT); channel.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4)); channel.pipeline().addLast(new JSONObjectDecoder()); channel.pipeline().addLast(new LengthFieldPrepender(4)); channel.pipeline().addLast(new JSONObjectEncoder()); channel.pipeline().addLast(new Connection(jaPSServer, channel)); }
From source file:de.jackwhite20.japs.shared.pipeline.initialize.ClientChannelInitializer.java
License:Open Source License
@Override protected void initChannel(Channel channel) throws Exception { try {/*from w w w . ja va 2 s .c om*/ channel.config().setOption(ChannelOption.IP_TOS, 0x18); } catch (ChannelException e) { // Not supported } channel.config().setAllocator(PooledByteBufAllocator.DEFAULT); channel.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4)); channel.pipeline().addLast(new JSONObjectDecoder()); channel.pipeline().addLast(new LengthFieldPrepender(4)); channel.pipeline().addLast(new JSONObjectEncoder()); channel.pipeline().addLast(nioSocketClient); }
From source file:io.advantageous.conekt.http.impl.HttpClientImpl.java
License:Open Source License
private void applyConnectionOptions(Bootstrap bootstrap) { bootstrap.option(ChannelOption.TCP_NODELAY, options.isTcpNoDelay()); if (options.getSendBufferSize() != -1) { bootstrap.option(ChannelOption.SO_SNDBUF, options.getSendBufferSize()); }/*from ww w . j ava 2 s .co m*/ if (options.getReceiveBufferSize() != -1) { bootstrap.option(ChannelOption.SO_RCVBUF, options.getReceiveBufferSize()); bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.getReceiveBufferSize())); } if (options.getSoLinger() != -1) { bootstrap.option(ChannelOption.SO_LINGER, options.getSoLinger()); } if (options.getTrafficClass() != -1) { bootstrap.option(ChannelOption.IP_TOS, options.getTrafficClass()); } bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, options.getConnectTimeout()); bootstrap.option(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.option(ChannelOption.SO_KEEPALIVE, options.isTcpKeepAlive()); bootstrap.option(ChannelOption.SO_REUSEADDR, options.isReuseAddress()); }
From source file:io.advantageous.conekt.http.impl.HttpServerImpl.java
License:Open Source License
private void applyConnectionOptions(ServerBootstrap bootstrap) { bootstrap.childOption(ChannelOption.TCP_NODELAY, options.isTcpNoDelay()); if (options.getSendBufferSize() != -1) { bootstrap.childOption(ChannelOption.SO_SNDBUF, options.getSendBufferSize()); }// w w w .j a va 2 s .c o m if (options.getReceiveBufferSize() != -1) { bootstrap.childOption(ChannelOption.SO_RCVBUF, options.getReceiveBufferSize()); bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.getReceiveBufferSize())); } if (options.getSoLinger() != -1) { bootstrap.option(ChannelOption.SO_LINGER, options.getSoLinger()); } if (options.getTrafficClass() != -1) { bootstrap.childOption(ChannelOption.IP_TOS, options.getTrafficClass()); } bootstrap.childOption(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.childOption(ChannelOption.SO_KEEPALIVE, options.isTcpKeepAlive()); bootstrap.option(ChannelOption.SO_REUSEADDR, options.isReuseAddress()); if (options.getAcceptBacklog() != -1) { bootstrap.option(ChannelOption.SO_BACKLOG, options.getAcceptBacklog()); } }
From source file:io.advantageous.conekt.net.impl.NetClientImpl.java
License:Open Source License
private void applyConnectionOptions(Bootstrap bootstrap) { bootstrap.option(ChannelOption.TCP_NODELAY, options.isTcpNoDelay()); if (options.getSendBufferSize() != -1) { bootstrap.option(ChannelOption.SO_SNDBUF, options.getSendBufferSize()); }/*from w w w . ja va 2 s .c o m*/ if (options.getReceiveBufferSize() != -1) { bootstrap.option(ChannelOption.SO_RCVBUF, options.getReceiveBufferSize()); bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.getReceiveBufferSize())); } if (options.getSoLinger() != -1) { bootstrap.option(ChannelOption.SO_LINGER, options.getSoLinger()); } if (options.getTrafficClass() != -1) { bootstrap.option(ChannelOption.IP_TOS, options.getTrafficClass()); } bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, options.getConnectTimeout()); bootstrap.option(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.option(ChannelOption.SO_KEEPALIVE, options.isTcpKeepAlive()); }
From source file:io.advantageous.conekt.net.impl.NetServerImpl.java
License:Open Source License
private void applyConnectionOptions(ServerBootstrap bootstrap) { bootstrap.childOption(ChannelOption.TCP_NODELAY, options.isTcpNoDelay()); if (options.getSendBufferSize() != -1) { bootstrap.childOption(ChannelOption.SO_SNDBUF, options.getSendBufferSize()); }// w ww .j a va2 s.c o m if (options.getReceiveBufferSize() != -1) { bootstrap.childOption(ChannelOption.SO_RCVBUF, options.getReceiveBufferSize()); bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.getReceiveBufferSize())); } if (options.getSoLinger() != -1) { bootstrap.option(ChannelOption.SO_LINGER, options.getSoLinger()); } if (options.getTrafficClass() != -1) { bootstrap.childOption(ChannelOption.IP_TOS, options.getTrafficClass()); } bootstrap.childOption(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.childOption(ChannelOption.SO_KEEPALIVE, options.isTcpKeepAlive()); bootstrap.option(ChannelOption.SO_REUSEADDR, options.isReuseAddress()); if (options.getAcceptBacklog() != -1) { bootstrap.option(ChannelOption.SO_BACKLOG, options.getAcceptBacklog()); } }
From source file:io.jsync.net.impl.TCPSSLHelper.java
License:Open Source License
public void applyConnectionOptions(ServerBootstrap bootstrap) { bootstrap.childOption(ChannelOption.TCP_NODELAY, tcpNoDelay); if (tcpSendBufferSize != -1) { bootstrap.childOption(ChannelOption.SO_SNDBUF, tcpSendBufferSize); }//from w w w. j a v a 2s .c o m if (tcpReceiveBufferSize != -1) { bootstrap.childOption(ChannelOption.SO_RCVBUF, tcpReceiveBufferSize); bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(tcpReceiveBufferSize)); } // TODO this may not be needed if (soLinger != -1) { bootstrap.option(ChannelOption.SO_LINGER, soLinger); } if (trafficClass != -1) { bootstrap.childOption(ChannelOption.IP_TOS, trafficClass); } bootstrap.childOption(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.childOption(ChannelOption.SO_KEEPALIVE, tcpKeepAlive); bootstrap.option(ChannelOption.SO_REUSEADDR, reuseAddress); bootstrap.option(ChannelOption.SO_BACKLOG, acceptBackLog); }