title: How to split packets in flash, XMLSocket
body: <p>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.</p>
  
  <p>Here is my packetHandler in flash</p>
  
  <pre><code>  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 &lt;= 0) return;
  
     switch(args[0]) {
      case 'w': //waiting
       ExternalInterface.call("waiting");
       break;
      case 'u': //user count
       if(args.length &gt;= 2)
        ExternalInterface.call("userCount", args[1]);
       break;
                                  //... etc handlers ...
     }
   }
  </code></pre>
  
  <p>A possible packet I sniffed sent by the server was.</p>
  
  <p>u:105.w.       aka              (75 3A 31 30 35 00 77 00)</p>
  
  <p>so the waiting packet never came in.</p>
  
  <p>How would i go about fixing this bug.. I am using XMLSocket</p>