Ah, the length of the frame is the length of the data plus the length of

the bytes used to transmit the length! So for our purposes, we just add 4.

I now have the ActionScript client authenticating with our server code!
Lots more to do...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3882 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-02-23 01:45:13 +00:00
parent 43f956c32d
commit bd235efe20
@@ -92,10 +92,12 @@ public class Communicator
// write the message (ends up in _outBuffer)
_outStream.writeObject(msg);
trace("outBuffer: " + Util.bytesToString(_outBuffer));
//trace("outBuffer: " + Util.bytesToString(_outBuffer));
// frame it by writing the length, then the bytes
_socket.writeInt(_outBuffer.length);
// Frame it by writing the length, then the bytes.
// We add 4 to the length, because the length is of the entire frame
// including the 4 bytes used to encode the length!
_socket.writeInt(_outBuffer.length + 4);
_socket.writeBytes(_outBuffer);
_socket.flush();