コード例 #1
0
        public NettyServer(string name, IPEndPoint listeningEndPoint, NettyServerSetting setting)
        {
            _listeningEndPoint = listeningEndPoint;

            _setting = setting ?? new NettyServerSetting(channel =>
            {
                var pipeline = channel.Pipeline;

                pipeline.AddLast(typeof(LengthFieldPrepender).Name, new LengthFieldPrepender(2));
                pipeline.AddLast(typeof(LengthFieldBasedFrameDecoder).Name, new LengthFieldBasedFrameDecoder(ushort.MaxValue, 0, 2, 0, 2));
                pipeline.AddLast(typeof(RequestEncoder).Name, new RequestEncoder());
                pipeline.AddLast(typeof(RequestDecoder).Name, new RequestDecoder(Request.Parser));
            });
            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(name ?? GetType().Name);

            InitializeNetty();
        }
コード例 #2
0
 public NettyServer(IPEndPoint listeningEndPoint, NettyServerSetting setting = null) : this("Netty server", listeningEndPoint, setting)
 {
 }