Hi all,
I started writing my own prefix string codec
factory, then realised there was one already.
But I'm having
trouble working how to encode the prefix. The client program
doesn't use Mina, so I'm doing this:
BufferedWriter wr = new
BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
String
myString = "Hello";
wr.write(myString.length());
wr.write(myString);
But this does not work. Meanwhile,
the PrefixedStringCodecFactory has a method,
setDecoderPrefixLength(prefixLength), and I'd assume that since I'm
sending an int, I'd want 4 bytes. I see in the source code that I need to do
whatever ByteBuffer's putInt does, but I'm not sure what that is.
Could
someone please tell me how to prefix the String in this situation? It
will be a C++ socket sending it later, which is why I'm not using the
encoder.
Regards,
Daniel
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5