byteBuf capacity in new protocol implement

hello,
I have implemented a new protocol. I just implemented a decoder for this protocol and I have not implemented anything else for this protocol yet. The protocol runs well and is implemented correctly, but in certain cases I encounter an error. After checking the code, I came to the conclusion that the error is related to the bytebuf capacity. It seems that over time, according to the length of the message sent, the bytebuf capacity decreases to a level that is sufficient for current messages, but if suddenly the message length More than the byteBuf capacity, the message is received in two steps and the byteBuf capacity increases, but I only have access to part of the message (as much as the previous byteBuf capacity). How should we handle this?
Should we use frameDecoder?

byteBuf.png

Anton Tananaev3 years ago

What's the error?

I'm looking for a special character for the end of the message, but I can not find it, and since the result is -1, I will continue to encounter the index error.

The message starts with hex 24 and ends with hex 24 ($ character) but according to the image the message is split into two parts and the start and end characters are not in one part

byteBuf2.png

byteBuf3.png

Anton Tananaev3 years ago

Do you have protocol documentation?

Unfortunately not. There are only codes in C # that were written by different people a long time ago and we are preparing a document based on these codes.

Anton Tananaev3 years ago

How is that code doing frame decoding? Using delimiter is probably not the right solution for a binary protocol.

I checked the my code and could not find an algorithm to reduce the buffer capacity. Is this done by the traccar?