[haXe] How to use haxe.remoting.SocketConnection?
Nicolas Cannasse
ncannasse at motion-twin.com
Fri Apr 13 20:34:48 CEST 2007
> Nicolas and list,
>
> does anybody know how to use haxe.remoting.SocketConnection? As far as
> I understand one should create that object and then pass everything that
> comes from the socket to processMessage method. It doesn't work though
> not in neko nor in flash. But it would work if you skip two first chars.
> The question is - why this method doesn't do that itself and is there a
> method that does it?
As you know, these first two chars contains the message body length
encoded. Usually when you use a haxe.remoting.SocketConnection in Flash,
you shouldn't have to worry about it since the XMLSocket.onData method
will be redefined and take care of it for your.
In Neko there are no events so you need to build you own server loop
that reads messages. You can either skip the first two bytes and read
the body until \0 is reached or use the first two chars to read the
message. If you don't want to do that by yourself then have a look at
the neko.net.ThreadRemotingServer class.
Nicolas
More information about the Haxe
mailing list