@vsudhini see the samples here:
https://github.com/Azure/DotNetty/tree/dev/examples
The EchoClient is probably the easiest to get started with
pipeline.AddLast(new ClientHandler());
}));
Hello Everyone
I am trying to do something like this :
Logger.info("nested function 1.......", 123);
context.log("context nested function 1.......", 123);
Where Logger is my own library :
static info(...message: any[]) {
context.log(message);
}
Output is :
nested function 1.......,123
context nested function 1....... 123
there is anyway to get out same like context ?
Hi everyone!
I just started with DotNetty/Netty
I'm working on a decoder for my custom protocol. Currently I'm using ReplayingDecoder<Enum>
decoder.
Now I'm running into IndexOutOfRangeException: readerIndex(4) + length(1280) exceeds writerIndex(10): PooledHeapByteBuffer(ridx: 4, widx: 10, cap: 256)
So I tried to fix it as followed:
if (input.ReadableBytes >= _messageFrame.Length)
{
_messageFrame.Payload = input.ReadBytes(_messageFrame.Length);
Checkpoint(ProtocolDecoderState.ReadEpilog);
}
which breaks my next switch case. case ProtocolDecoderState.ReadEpilog
Here is the whole code:
protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
{
switch (State)
{
case ProtocolDecoderState.ReadProlog:
_messageFrame.Prolog = input.ReadByte();
Checkpoint(ProtocolDecoderState.ReadMessageType);
break;
case ProtocolDecoderState.ReadMessageType:
_messageFrame.SetMessageType(input.ReadByte());
Checkpoint(ProtocolDecoderState.ReadLength);
break;
case ProtocolDecoderState.ReadLength:
_messageFrame.Length = input.ReadShort();
Checkpoint(ProtocolDecoderState.ReadPayload);
break;
case ProtocolDecoderState.ReadPayload:
if (input.ReadableBytes >= _messageFrame.Length)
{
_messageFrame.Payload = input.ReadBytes(_messageFrame.Length);
Checkpoint(ProtocolDecoderState.ReadEpilog);
}
break;
case ProtocolDecoderState.ReadEpilog:
_messageFrame.Epilog = input.ReadByte();
output.Add(ProtocolHelper.CovertByteFrameToMessage(_messageFrame));
Checkpoint(ProtocolDecoderState.ReadProlog);
_messageFrame = new MessageFrame();
break;
default:
throw new InvalidDataException("Shouldn't reach here.");
}
}
Do I need to use the ByteToMessageDecoder
instead?
Can I not use the ReadBytes(int length)
in the ReplayingDecoder
?
Thanks!!