While working on the WiFi interface between a data collection system operating only through RS232 and a controlling system on a PC or Android phone that uses TCP/IP socket communications I have realized that there [u]might[/u] exist a problem with data transfers [u]to[/u] the RS232 based system.
So I want to ask here if the UART-bridge examples are able to handle data coming in on the TCP/IP link at a faster rate than it is possible to send it out the UART at 38400 baud? The code examples I have found work in similar ways in loop() by checking if there are data on the incoming TCP connection and if so reads that and writes it to the serial port. Next the serial port is checked for incoming data which is read if existing and pushed out the TCP socket connection. Then loop() exits and is restarted by the underlying system.
I see no handling of buffers of data here, so my question is if this is done "under the hood" by the ESP8266 library such that the incoming data are "throttled" to a speed that can be handled by the outgoing UART? Or if data arrives at a faster pace it will be overrun and communication breaks?
As an example, imagine that the controller software needs to send a chunk of 2 Mbytes of binary data to the data collection system. This will need a transfer time of 8 min 40s over the serial connection. But the WiFi network from the controller software to the ESP8266 unit is orders of magnitude faster so it would probably need only a few seconds to dump the binaries onto the ESP. But the ESP does not have such a big buffer RAM, right?
Will this transfer be controlled by some method in the TCP/IP subsystem such that incoming data are only allowed at a rate compatible with the serial port baud rate?
If not, can someone suggest how it can be handled? Maybe some flow control inside the loop() function?