So this how i see it. Every step i make in decoder i mean: if(in.prefixedData(x)) // one step = decode next "element" i have to put this data in my DecoderState for specific kind of data ? i.e. MessageAstate,MessageXstate etc. and if next step will return false. Then decoder will be executed again and as in example i will check my specific decoder what kind of data should i "load" (in.getSomething()). Do i get it right ?
2012/1/24 Emmanuel Lécharny <elecha...@apache.org> > On 1/24/12 12:55 AM, Robert Tomczyk wrote: > >> Ok i get it, and yes, you were right it was my fault i just forgot to put >> one line of code ( break; ) in client decoder. >> > Break... The most frequently forgotten keyword :) > > > But still another problem >> appears when Messages sended by one side contains more than one String (or >> couple of messages with String each). >> >> - as the incoming byte[] can be fragmented (ie, there is no guarantee >> >>> whatsoever that the bytes won't be send one byte by one byte to the >>> remote >>> peer), you have to deal with this fragmentation. >>> >> Can you explain me how ? Or give me some examples, because i didnt find >> any >> straight answer on mailinglists. >> > Look at > http://mina.apache.org/**chapter-11-codec-filter.html<http://mina.apache.org/chapter-11-codec-filter.html>, > and more specifically the decoder part. Using a CumulativeProtocolDecoder > will handle the storage of fragmented data, while the code you wrote will > handle the decoding, returning 'true' when you've get a complete message. > > >> >> This is only a problem on the decoder size (we don't fragment anything >>> when we send data : we consider a message as a whole), and the only way >>> to >>> deal with this fragmentation is to accumulate the incomig bytes before >>> doing the decoding of a complete message >>> >> How to do this ? besides example which i put in first post. >> > see my answer to your previous question above. > > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > >