> The issue is that I will be sending the string from a C++ socket, so I can't 
> just use putPrefixedString().  When my test client uses the code I provided 
> before, (i.e., wr.write(myString.length()); wr.write(myString);)  I get the 
> following at the INFO level, which is before any of my code in 
> messageReceived() runs.  Obviously the dataLength is over the top.
>
> INFO: RECEIVED: HeapBuffer[pos=0 lim=2048 cap=2048: 05 3C 3F 78 6D 6C 20 76 
> 65 72 73 69 6F 6E 3D 27...]
> org.apache.mina.filter.codec.ProtocolDecoderException: 
> org.apache.mina.core.buffer.BufferDataException: dataLength: 87834488 
> (Hexdump: 05 3C ...blah blah)
>    at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:235)
>
> This suggests I am not emulating putPrefixedString correctly.

hmm, you need to write the length of the byte array of the string you
are sending instead of writing the
length of the string.
byte[] data = myString.getBytes( "UTF-8" );
wr.write(data.length);
wr.write(myString);

HTH
Kiran Ayyagari

Reply via email to