public void SendA(IChannelHandlerContext ctx, CCMessage data)
        {
            var coreframe = new CCMessage();

            coreframe.Write(Magic);
            coreframe.WriteScalar(data.Length);
            coreframe.Write(data);

            var buffer = Unpooled.Buffer(coreframe.Length);

            buffer.WriteBytes(coreframe.Buffer);
            ctx.WriteAndFlushAsync(buffer);
        }
        private static Task SendA(IChannelHandlerContext ctx, CCMessage data)
        {
            var coreframe = new CCMessage();

            coreframe.Write(Magic);
            coreframe.WriteScalar(data.Length);
            coreframe.Write(data);

            var buffer = Unpooled.Buffer(coreframe.Length);

            buffer.WriteBytes(coreframe.Buffer);
            ctx.WriteAndFlushAsyncEx(buffer).WaitEx();
            return(Task.CompletedTask);
        }
示例#3
0
        private static Task SendA(IChannelHandlerContext ctx, CCMessage data)
        {
            var coreframe = new CCMessage();
            coreframe.Write(Magic);
            coreframe.WriteScalar(data.Length);
            coreframe.Write(data);

            var buffer = Unpooled.Buffer(coreframe.Length);
            buffer.WriteBytes(coreframe.Buffer);
            try
            {
                ctx.WriteAndFlushAsync(buffer).WaitEx();
            }
            catch (Exception e)
            {
                ctx.FireExceptionCaught(e);
            }

            return Task.CompletedTask;
        }