Hi Everybody;

I hope my question won't seem so trivial, I am pretty new to Mina, but I am
making some progress, I managed to write my own protocolfilter for my byte
stream TCP protocol.

Here is some information about my protocol details.

Every message starts with a certain character, and end with a certain
character. Every message contains some fixed length fields and variable
length fields. For each variable length field I have another dedicated field
that tells the length of the field in question. Before clients send the
message to the socket on the server, they stuff everything between message
start and message end, to prevent any existence of the special
bytes(beginning byte and ending byte), they simply insert a constant byte
before the special character and add the constant byte to the special byte
and place it to the next location in the byte stream.

So server has to go through the complete message and unstuff these cases, by
doing the reverse operation.

That operation would be so easy to accomplish if everything is guaranteed to
be received in one piece. But since there might be fragmentation, I am not
quite sure if I will be able to decode my object inside doDecode method.

One Possible solution is looping through the message until seeing the end
byte and passing that to somewhere else to process unstuffing. Because of
stuffing I am guaranteed to have one end and one beginning bytes in a
message, so that will do it.

I am wondering if there might be a better solution by implementing something
inside Mina's functionality?

Thanks in advance

Erinc

Reply via email to