Thanks ! i will change it and try. If you have a sample TextCodec cumulative please send me link Many Thanks F.
2010/9/7 Emmanuel Lécharny <[email protected]> > On 9/7/10 9:45 AM, FLV wrote: > >> Hi, thanks for the answer, i will try to be more clear about my protocol: >> > <snip/> > >> "*do you deal with the fact that you may have more than one message to >> deal >> >> with in the decoder ?* " >> >> I thought yes, for each packet of a single message, client or server >> receive, i use a Map (Map<Long, String> buffer => <sessionId, packet> ) >> in >> order to store the single message. >> And it is working 9 times on 10. >> > What you do in the doDecode() method is to consume *all* the bytes in the > incoming buffer, which is correct. But as soon as you get a '\0' (which > seems to be a message boundary), you send it and you get out of the doDecode > method. This is not good if you have more than one message in your buffer. > > You should iterate on the buffer until you meet this boundary, and return, > as the decode() method will call back doDecode() again until the buffer is > empty. > > > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > >
