private void OnMessageArrived(ArraySegment <byte> message) { byte[] data = new byte[message.Count]; Array.Copy(message.Array, message.Offset, data, 0, message.Count); _messageHandler(_connection, data, reply => _connection.SendAsync(_messageFramer.FrameData(new ArraySegment <byte>(reply, 0, reply.Length)))); }
public void SendAsync(byte[] message) { _connection.SendAsync(_framer.FrameData(new ArraySegment <byte>(message, 0, message.Length))); }