Erinc Arikan wrote:
Hi,

I just started working on MINA last week, I am trying to convert a gateway
application to MINA - ACTIVEMQ project. I am really impressed the simplicity
MINA brings.

After this irrelevant introductory part, Here's my problem:

My clients connect to the server using a tcp connection.

I created my own protocolfilter where I specify my encoder and decoder.
Decoder on the server side what I care about most, because that's what I
will pass into activemq and process.

Only filters that I use are my custom protocolfilter and loggingfilter, the
problem lies here: if my client sends a packet of length 78 bytes, decoder
in my protocolfilter receives a 0 padded 72 bytes of data. When I strip 0's
and and reach end of the message delimiter byte, I realize that what I
receive is 72 bytes long. And it somehow matches crc16 calculation from the
message but still some bytes are missing. Same thing happened when my
message has size 40 and decoder received 35 bytes. I don't know what I am
doing wrong but since CRC values match I feel like there is something wrong
on my side. Unfortunately I couldn't find an answer to this question on
documentation.

Any help will be greatly appreciated.

Remember that there is no guarantee that your message will arrive in one chunk of exactly 78 bytes. You may as well receive 78 messages containing one single byte. You have to accumulate them until you get what you need.
Erinc



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to