views:

9

answers:

2

Hello I believe my flash client is losing some packets the server sends, because some packets get joined together hence I believe it drops them.

Here is my packetHandler in flash

  private var xmlsock:XMLSocket;
  this.xmlsock = new XMLSocket();
  xmlsock.connect("127.0.0.1", 1234);
  this.xmlsock.addEventListener(DataEvent.DATA, this.packetHandler);


  public function packetHandler(event:DataEvent):void {
   var packet:String = event.data;
   var args:Array = packet.split(":");
   if(args.length <= 0) return;

   switch(args[0]) {
    case 'w': //waiting
     ExternalInterface.call("waiting");
     break;
    case 'u': //user count
     if(args.length >= 2)
      ExternalInterface.call("userCount", args[1]);
     break;
                                //... etc handlers ...
   }
 }

A possible packet I sniffed sent by the server was.

u:105.w. aka (75 3A 31 30 35 00 77 00)

so the waiting packet never came in.

How would i go about fixing this bug.. I am using XMLSocket

A: 

Use a flash.net.Socket instead.

Eugene
A: 

K solved if anyone needs help with this turns out you can just do this

var packets:Array = data.split("\x00");

SSpoke