Exemple #1
0
        public RPCClient(AbsClientConnect _clientConnect) : base(_clientConnect)
        {
            bootstrap = new Bootstrap()
                        .Group(new MultithreadEventLoopGroup())
                        .Channel <TcpSocketChannel>()
                        .Option(ChannelOption.TcpNodelay, true)
                        .Handler(new ActionChannelInitializer <ISocketChannel>(channel =>
            {
                var pipeline = channel.Pipeline;
                pipeline.AddLast("framing-enc", new LengthFieldPrepender(2));
                //数据包最大长度
                pipeline.AddLast("framing-dec", new LengthFieldBasedFrameDecoder(ushort.MaxValue, 0, 2, 0, 2));

                pipeline.AddLast(new ClientHandler(allWaits));
            }));
        }
Exemple #2
0
 public ApiClient(AbsClientConnect _clientConnect) : base(_clientConnect)
 {
 }
 public WebSocketClient(AbsClientConnect _clientConnect) : base(_clientConnect)
 {
 }
 public WebSocketClientHandler(WebSocketClientHandshaker handshaker, ResponseWaits _waits, AbsClientConnect _clientConnect)
 {
     this.handshaker       = handshaker;
     clientConnect         = _clientConnect as WebSocketClientConnect;
     this.completionSource = new TaskCompletionSource();
     waits = _waits;
 }