Skip navigation
Currently Being Moderated

Issues about transmitting data by http post

May 10, 2013 5:41 AM

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.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points