2 Replies Latest reply on May 10, 2013 9:48 PM by GankerPudge

    Issues about transmitting data by http post

    GankerPudge

      public function Main():void

      {

                var i:int;

                var j:int;

                var request:URLRequest = new URLRequest( "http://127.0.0.1:8080/myapp/info" );

                request.data = new ByteArray();

      L1:

       

                for ( j = 0 ; j < 1000 ; ++j )

                {

       

      L2:               var loader:URLLoader = new URLLoader();

                          var tsPkt:ByteArray = new ByteArray();

       

                          for ( i = 0 ; i < 188 ; ++i )

                                    tsPkt.writeByte( 0xff );

       

                          request.data.writeBytes( tsPkt , 0 , tsPkt.length );

                          loader.dataFormat = URLLoaderDataFormat.TEXT;

                          request.method = URLRequestMethod.POST;

                          loader.load( request );

       

                          tsPkt.clear();

                          request.data.clear();

                }

      }

       

       

      Hi guys,

       

      I set a counter to count the packets I received from this POST method.

      I have two questions about above code segment.

      1.  When I move the statement from L2 to L1, the counter is just 1 instead of 1000, why?

      2.  When I change the j's upper to 2000, some packets will be lost, the upper bigger, the lost packets more, what is the root cause?

       

      I tried many times, the result is disappoint, help!

      Thanks to you guys.