I'm trying to show the message in a string that was sent by the client. I coded a simple client application and then coded a server with DotNetty. The client app is just for testing.
Client:
var ipAddress = "127.0.0.1";
var port = 1232;
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
socket.Connect(new IPEndPoint(IPAddress.Parse(ipAddress), port));
}
catch (SocketException se)
{
}
byte[] forwardMessage = Encoding.Default.GetBytes("lol");
socket.Send(forwardMessage);
Console.ReadLine();
Server decoder:
internal class Decoder : MessageToMessageDecoder<IByteBuffer>
{
protected override async void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
{
Console.WriteLine("Socket says: " + input.ToString());
}
}
When sending a message from the client to the server I get this.
Socket says: InstrumentedUnpooledHeapByteBuffer(ridx: 0, widx: 3, cap: 1024)