ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By Sprite_tm
#5291
pvvx wrote:espconn_sent no changed in version 0.9.4.
Errors in esp-httpd to espconn_sent with the first versions. Transmit buffer can not be free until the end of data transfer to the client (up to confirm tcp stack - RX [ACK])
Not https://en.wikipedia.org/wiki/Nagle%27s_algorithm :)


You seem to 'know' an espconn_sent implies sending exactly one TCP packet. I assumed espconn_sent works more like scatter/gather; sending everything passed through to all the calls as one packet at the end of the callback. May I ask if you actually have sources to back up your claim, or are you just speculating it has something to do with Nagles algorithm?
User avatar
By pvvx
#5320
Sprite_tm wrote:
pvvx wrote:espconn_sent no changed in version 0.9.4.
Errors in esp-httpd to espconn_sent with the first versions. Transmit buffer can not be free until the end of data transfer to the client (up to confirm tcp stack - RX [ACK])
Not https://en.wikipedia.org/wiki/Nagle%27s_algorithm :)


You seem to 'know' an espconn_sent implies sending exactly one TCP packet. I assumed espconn_sent works more like scatter/gather; sending everything passed through to all the calls as one packet at the end of the callback. May I ask if you actually have sources to back up your claim, or are you just speculating it has something to do with Nagles algorithm?

Use Lwip:
tcp_nagle_enable ( struct tcp_pcb * aPcb ); // enable the nagle algorithm
tcp_nagle_disable ( struct tcp_pcb * aPcb ); // disable the nagle algorithm
tcp_nagle_disabled ( struct tcp_pcb * aPcb ); // return true if the algorithm is not enabled
espconn send not buffered - tcp_write(struct tcp_pcb * pcb, void * dataptr, u16_t len, u8_t apiflags = 0) http://lwip.wikia.com/wiki/Raw/TCP

+ When TCP stack receives data, espconn always confirms the acceptance of full size (~ 5600 bytes). Uses tcp_recved(). If you do not have time to process stream with Wi-Fi in the 1 megabyte per second, then there will be an overflow.
Espconn not used to throttle data reception. Espconn uses automatic update the TCP window for receiving data :) there is no way to fix this in espconn...
User avatar
By Sprite_tm
#5336 I do disagree with you there, pvvx. First of all, the wiki says nothing about tcp_write being able to be called just once per callback; knowing lwip, they have some pretty nice scather/gather-algos going on for it. Second of all, the use of tcp_write hasn't been changed between the 0.9.3 and 0.9.4 source code; if what you say is true, sending multiple bits of data by calling espconn_sent multiple times shouldn't have worked in 0.9.3 either.
User avatar
By pvvx
#5338
Sprite_tm wrote:I do disagree with you there, pvvx. First of all, the wiki says nothing about tcp_write being able to be called just once per callback; knowing lwip, they have some pretty nice scather/gather-algos going on for it. Second of all, the use of tcp_write hasn't been changed between the 0.9.3 and 0.9.4 source code; if what you say is true, sending multiple bits of data by calling espconn_sent multiple times shouldn't have worked in 0.9.3 either.

esp_iot_sdk_v094/libs/lwip/app/espconn_tcp.c, line 191, func: espconn_tcp_sent(), added only :
ptcp_sent->pcommon.write_len = len;

Sourse liblwip.a (Lwip 1.4.0 + espconn) are Iot_demo.
My supplement (fixed many errors) - viewtopic.php?f=6&t=946#p5278