TCP flow control in AS3?

I am currently working on a Flash socket client for an existing service / standard. The service uses TCP flow control to throttle itself, and the Flash socket reads as fast as possible, even though it cannot process it as fast as it does. This leads to the fact that bytesAvailable in the juice continues to increase, and the server never knows that the client is lagging.

In short, is there any way to limit the size of bytes available to a Flash Socket object or otherwise shut it down?

Note. Overwriting the server is not a viable option at this time, since it is standard and the client utility crashes very much if changes are needed on the server side.

+3
source share
2 answers

After researching, I found that the ActionScript Socket class will start to throttle when the CPU is exceeded on the system (probably due to lack of resources / slow response time).

This actually solved my problem, because I wrote the code in such a way that it found a balance between the number of frames per second that the application β€œwants” and the number of bytes available on the socket. If bytesAvailable is too large, the application will process non-stop and transfer the CPU to 100%, resulting in a slower socket.

+2
source

, . AS3 API, TCP. . : , Socket byteArray, , . - .

0

Source: https://habr.com/ru/post/1729961/


All Articles