0

私は小さなnettyサーバープログラムを書きました。すべての電話で動作しますが、サーバーはandroid mobile(Client)に対してのみRSTリクエストを送信します。また、正常に動作する場合もありますが、問題が発生する場合もあります。

助けて。

        ChannelFactory factory = new NioServerSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool());

    bootstrap = new ServerBootstrap(factory);

    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() {
            // new SslHandler(getSSLEngine()),
            return Channels.pipeline(
                    new MobileDecoder(),
                    new MobileChannelHandler(MobileMessageHandler
                            .getInstance()));
        }
    });

    bootstrap.setOption("child.tcpNoDelay", true);
    bootstrap.setOption("child.keepAlive", true);
    bootstrap.bind(new InetSocketAddress(9083));
4

1 に答える 1

1

試してみてくださいOioServerSocketChannelFactory。多くのAndroidデバイスには、バグのあるNIO実装が付属しています。

于 2011-12-01T08:06:15.130 に答える