Throttling incoming data into the ESP8266
Posted: Sun Oct 25, 2015 9:51 pm
While studying the ESP8266, I understand that I can form a TCP connection to the partner. The partner can then start pushing data down the pipe for consumption by my own application. When the partner sends data, I wake up in the callback registered by espconn_regist_recvcb() and am passed a copy of the data that I can't "hold onto" after the callback completes.
Since I also can't spend too long in the callback function, it makes sense to take a copy of the received data for subsequent processing.
And with that background ... here is my dilemma.
Imagine my partner is sending me data faster than I can process it. For example, if my partner is sending me 5K of data each 100msecs but I can only process 1K of data each 100msecs then I am going to be in trouble.
If I can't process the data at the rate my partner is sending, I somehow need to throttle the transmission rate. The question is ... how do I do that? Imagine I have no application level protocol control at the application level. What I feel I want to do is throttle the ability of the ESP8266 to say "Hey partner, I know you have data to send to me ... but keep it in your own buffers ... my buffers are full. I'll tell you when you can push more to me!".
Is such a thing possible?
Since I also can't spend too long in the callback function, it makes sense to take a copy of the received data for subsequent processing.
And with that background ... here is my dilemma.
Imagine my partner is sending me data faster than I can process it. For example, if my partner is sending me 5K of data each 100msecs but I can only process 1K of data each 100msecs then I am going to be in trouble.
If I can't process the data at the rate my partner is sending, I somehow need to throttle the transmission rate. The question is ... how do I do that? Imagine I have no application level protocol control at the application level. What I feel I want to do is throttle the ability of the ESP8266 to say "Hey partner, I know you have data to send to me ... but keep it in your own buffers ... my buffers are full. I'll tell you when you can push more to me!".
Is such a thing possible?