예제 #1
0
        public static async Task Start(string host, int port, Dictionary <int, ProtocolCreator> factories)
        {
            Ins = new GenClient();
            var c = new TcpClientBootstrap
            {
                RemoteAddress       = new IPEndPoint(IPAddress.Parse(host), port),
                ConnectTimeoutMills = 3000,
                EventLoop           = new EventLoop(null),
                InitHandler         = ch =>
                {
                    ch.Pipeline.AddLast(new ProtocolFrameCodec(20_000_000, new RecycleByteBufPool(100, 10), new DefaultProtocolAllocator(factories)));
                    ch.Pipeline.AddLast(Ins);
                }
            };

            var ch = await c.ConnectAsync().ConfigureAwait(false);
        }
예제 #2
0
 public static void Stop()
 {
     _   = Ins.Session.CloseAsync();
     Ins = null;
 }