WriteStringToBuffer() static private method

static private WriteStringToBuffer ( IByteBuffer buffer, string input ) : void
buffer IByteBuffer
input string
return void
示例#1
0
        public async Task <bool> SendToClientAsync(string instanceId, string messageType, byte[] data)
        {
            IChannel channel;

            lock (this)
            {
                if (!this.channels.TryGetValue(instanceId, out channel))
                {
                    return(false);
                }
            }

            var buffer = Unpooled.Buffer(512 + data.Length);

            NettyClient.WriteStringToBuffer(buffer, messageType);
            buffer.WriteBytes(data);

            await channel.WriteAndFlushAsync(buffer);

            return(true);
        }