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
K solved if anyone needs help with this turns out you can just do this
var packets:Array = data.split("\\x00");
请改用flash.net.Socket
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.