0

我的用户正在向我报告此错误,我想默默地忽略它,因为它不是我的应用程序的非关键部分。

2013-02-09 15:20:15 [警告] 无法设置通道选项:[id: 0x8cf59443, /84.100.204.150:51292 => /87.98.181.225:22091] io.netty.channel.ChannelException: java. net.SocketException:无效参数:在 io.netty.channel.socket.DefaultSocketChannelConfig.setOption(DefaultSocketChannelConfig.java:115) 在 io.netty.channel.socket.DefaultSocketChannelConfig.setTrafficClass(DefaultSocketChannelConfig.java:264) 在 io 没有更多信息.netty.bootstrap.ServerBootstrap$ServerBootstrapAcceptor.inboundBufferUpdated(ServerBootstrap.java:264) 在 io.netty.channel.DefaultChannelHandlerContext.invokeInboundBufferUpdated(DefaultChannelHandlerContext.java:1170) 在 io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated0(DefaultChannelHandlerContext.java:1148) ) 在 io.netty.channel。DefaultChannelHandlerContext.fireInboundBufferUpdated(DefaultChannelHandlerContext.java:1127) 在 io.netty.channel.DefaultChannelPipeline.fireInboundBufferUpdated(DefaultChannelPipeline.java:903) 在 io.netty.channel.socket.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:84)在 io.netty.channel.socket.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:397) 在 io.netty.channel.socket.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:361) 在 io.netty.channel.socket .nio.NioEventLoop.run(NioEventLoop.java:301) at io.netty.channel.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110) at java.lang.Thread.run(Unknown Source) 原因:java.net。 SocketException:无效参数:sun.nio.ch.Net 上没有更多信息。setIntOption0(Native Method) at sun.nio.ch.Net.setSocketOption(Unknown Source) at sun.nio.ch.SocketChannelImpl.setOption(Unknown Source) at sun.nio.ch.SocketAdaptor.setIntOption(Unknown Source) at sun。 nio.ch.SocketAdaptor.setTrafficClass(Unknown Source) at io.netty.channel.socket.DefaultSocketChannelConfig.setTrafficClass(DefaultSocketChannelConfig.java:262) ... 12 更多

为了做到这一点,我只是IP_TOS在我的ServerBootstrapchildOption(ChannelOption.IP_TOS, 0x18)

如果您知道我需要在哪里放置处理程序,或者选择忽略设置此选项失败的选项,请告诉我。

md_5

4

1 回答 1

3

这是一个设置选项的示例引导代码:

        Bootstrap b = new Bootstrap();
        b.group(new NioEventLoopGroup(), new NioEventLoopGroup())
         .channel(NioServerSocketChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SocketChannel>() {
             @Override
             public void initChannel(SocketChannel ch) throws Exception {
                 try {
                     ch.config().setTrafficClass(0x18);
                 } catch (ChannelException e) {
                     // Ignore
                 }
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new EchoServerHandler());
             }
         });
于 2013-02-10T00:57:02.683 回答