From bd235efe20ce2ffdaa3000c069cc3745a04ab3d3 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 23 Feb 2006 01:45:13 +0000 Subject: [PATCH] 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 --- src/as/com/threerings/presents/client/Communicator.as | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/as/com/threerings/presents/client/Communicator.as b/src/as/com/threerings/presents/client/Communicator.as index b1557186d..a4849388e 100644 --- a/src/as/com/threerings/presents/client/Communicator.as +++ b/src/as/com/threerings/presents/client/Communicator.as @@ -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();