On 1/22/12 2:23 AM, Robert Tomczyk wrote:
Hi can you explain me how to properly send String through network and/or
how to deal with fragmentation. As far i read some (not very informative)
tutorials i still have some problems.
I dont know why but some messages going through network(local) without
problem and some doesnt. I found where the problem appears. Im trying to
send 3 messages from server ( session.write(MessageA),
session.write(MessageB), session.write(MessageC) ) to client.
So when im sending MessageA which contains some Number values (int,long)
it works fine, same with MessageB which contains few Number values and
String, and when im sending MessageC which contains about 30 of Number
values and String, its not always delivered. I tried to send only 2
combinations. MessageA and B works fine, rest MessageC + A or B dosnt and
session is blocked( somehow , but i cant use it anymore, well im sending
request but didnt get response which server sends) . With that MessageC all
happens randomly.In one case im only get MessageC and after another request
for these kind of data im get second message MessageB(or A) and again only
MessageC. I believe it has something to do with fragmentation.
Im extending CumulativeProtocolDecoder as a filter, it looks simple like
this Enum as a messageType, then int as messageLength, and rest of data
Help !
Sorry, but we don't have enough information to tell you what's wrong in
your code. Your doDecode method seems correct pseudo-code, AFAICT, so
here must be some issue elsewhere, like in the codec, or in the kind of
filters you are using.
- first, which MINA version are you using ?
- are you sending the 3 messages in a row, or are you sending them as a
reply to three different messageReceived() vent ?
- what filters do you have in your chain ?
- have you checked using a sniffer (like Wireshark) that the PDU are
correctly sent and are not fragmented ?
Sorry to answer to your questions by other questions, but it's really
likely that you have some issues in the way you use MINA and as I don't
see your code, it's hard to tell what can go wrong...
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com