Skip navigation
mepmay
Currently Being Moderated

AS3/Sockets: more than 100 ms between ProgressEvent.SOCKET_DATA events?

Jan 16, 2012 4:03 AM

Tags: #as3 #sockets

Hello,

 

I'm sending images from a server, in C-berkeley sockets, to a Flash client, both on the same Linux machine:

  • Average size of each package: 35000 bytes.
  • Flash requests an image, and the server sends it.
  • Server spends 30 ms to get,compress and send the image.
  • OpenCV is used to grab each frame from a webcam.
  • On Flash, first frames are received in time, every 60 ms but then the elapsed time between two reception events (ProgressEvent.SOCKET_DATA is 170 ms. So it displays images with a low frame rate.
  • The visualization is not smooth but blurred.

 

Anyway, the server never waits more than 40 ms to get a client's request, this is what I measure at least..., so is either Flash or server "lying" to me?

 

If I connect the same Flash to a "as3-server" (OpenKinect server which gets images from the Microsoft's Kinect), everything is OK.

Maybe there is some issue on the server side but I'm using a dedicated one with the classical functions (bind, accept, read, write and close). Any thoughts?

 

Regards.

 
Replies
  • Currently Being Moderated
    Aug 17, 2012 1:56 AM   in reply to mepmay

    I'm experiencing the same issue.

     

    I'm sending images from a C# server to an AS3 client.

    Everything is fine, with a transfert time of around 30ms per image.

    Then, for no apparent reason images take 300 or 600 or more time to get to the client.

    Then, after even some more time, it fixes itself and goes back to 30ms.

     

    - When everything is fine, SOCKET_DATA events contain about 24820 bytes each. (images themselves are 1 to 8MB).

    - When the problem occurs, SOCKET_DATA events contain 65636 bytes each, with occasionally lower values.

    - It is only some SOCKET_DATA events that takes long to be called back, generally one or two per image sent.

     

    I have series like this:

     

    (normal)

    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.

    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.

    socket.bytesAvailable: 24820 bytes. Inactive for 0ms.

     

    (slow)

    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.

    socket.bytesAvailable: 25996 bytes. Inactive for 0ms.

    socket.bytesAvailable: 6944 bytes. Inactive for 297ms.

    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.

    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.

    socket.bytesAvailable: 11104 bytes. Inactive for 0ms.

    socket.bytesAvailable: 6944 bytes. Inactive for 273ms.

    socket.bytesAvailable: 65536 bytes. Inactive for 0ms.

     

    Where "Inactive" is the ammount of time spent between SOCKET_DATA callbacks, outside of my code.

    Some packets just take super long to be reconstructed into the byte array and sent to me in the socket data event.

    It looks like this happen after a buffer underflow.

    I have verified that this behavior is not due to Flash rendering (same problem if I don't display the images or don't do anything else).

     

    Currently my only viable workaround is to detect these long transferts and force a disconnection and reconnection.

     

    Anyone has experienced this and found a better solution or explanation ?

     
    |
    Mark as:

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