Flow control using the ESP8266 SDK
Posted: Sat Nov 07, 2015 11:48 pm
Consider an ESP8266 coded to use the Espressif SDK. Imagine a TCP connection is created between it and a back-end server. Now imagine that the back-end server has mega bytes of data that it wishes to send to the ESP8266 over time. Obviously, the amount of RAM in the ESP8266 is limited ... as such, it can't receive and buffer all the data until it is consumed. For this to appear to work, the ESP8266 would have to tell the source of the data when it may transmit the next chunk of data. Here is where I am getting puzzled.
In a Unix level sockets application, I can imagine a receiver of data not asking for more data until it executes a "read()" call to read some more. However, in an ESP8266, I believe we are supposed to register a receiver callback function that gets invoked whenever the partner sends new data and the receiver is expected to cache the data for later consumption. This doesn't appear to include any flow control function or capability. As such, my question becomes ... how would I achieve my goal of throttling the amount of data sent by the transmitter through my ESP8266 receiver?
In a Unix level sockets application, I can imagine a receiver of data not asking for more data until it executes a "read()" call to read some more. However, in an ESP8266, I believe we are supposed to register a receiver callback function that gets invoked whenever the partner sends new data and the receiver is expected to cache the data for later consumption. This doesn't appear to include any flow control function or capability. As such, my question becomes ... how would I achieve my goal of throttling the amount of data sent by the transmitter through my ESP8266 receiver?