Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By Chris--A
#15462
reaper7 wrote:@Chris--A - simple replace delay with this function?
What exactly this function (tcp_output) does?


A simple replace is worth a try. The function forces queued data to be sent, whereas tcp_write just queues it. And I assume the delay is to allow interrupts to fire.

http://lwip.wikia.com/wiki/Raw/TCP#Sending_TCP_data
User avatar
By martinayotte
#15506 Hi Chris !
It seems that you put your finger on the right place !!! Thanks a lot !!!
Although the latency was never reaching 5000ms, I've replaced the delay(5000); by tcp_output(_pcb); and gave it a try :
The latency was gone, and consequently, the bytes received on serial during latencies were not dropped any more (I didn't added a double buffer for serial input to be filled by interrupt, only the main loop was filling the buffer). I've done a small stress test by sending a 1MB text file over Serial2TCP and the result diff was Ok !

So, this patch maybe should be submitted to IGRR ...
User avatar
By draco
#15510 I have posted some performance benchmark type numbers in another thread here.

Summary: there doesn't seem to be much performance difference between .write() and .print(), both take about 125ms, regardless of how big the data you're sending is. The .println() function takes an extra 125ms, because internally, it does a .print() of your data then another .print("\n").

In practice, I have never encountered the 5000 ms delay referenced above. That should only ever happen if there's an error during the transmission process.