Hello everybody.
I use an ESP32 with the Arduino IDE. In the simple WiFiServer, which instances a WiFiClient for each client connection, I try to see if there is enough room in the TX buffer before sending a complete line. I tried to use availableForWrite () method in order to see if the result is greater than the size of the line that I want to send. But availableForWrite () returns always zero. So... how can I test the available space in the TX buffer ?
WiFiCLient::availableForWrite() returns 0
Re: WiFiCLient::availableForWrite() returns 0
I have this same problem as well!
int i = tcpClient.availableForWrite();
This always returns with i equal to 0. This code works perfectly when compiled for the ESP8266.
int i = tcpClient.availableForWrite();
This always returns with i equal to 0. This code works perfectly when compiled for the ESP8266.
Re: WiFiCLient::availableForWrite() returns 0
I have recently run across this exact same issue with a ESP32C3. Code that compiles and works perfectly on the ESP8266 does not work on the ESP32C3 (maybe other ESP32 versions?)
if (tcpClient.availableForWrite() > 0) {
tcpClient.write(sendbuf, sendlength);
}
This skips the write because the result from tcpClient.availableForWrite() is always 0. Again, with a ESP8266 this works perfectly. Any ideas?
If I modify the code to not do the check if data can be sent then my code works, but there is a possibility of over-running the buffer at that point.
if (tcpClient.availableForWrite() > 0) {
tcpClient.write(sendbuf, sendlength);
}
This skips the write because the result from tcpClient.availableForWrite() is always 0. Again, with a ESP8266 this works perfectly. Any ideas?
If I modify the code to not do the check if data can be sent then my code works, but there is a possibility of over-running the buffer at that point.
Who is online
Users browsing this forum: No registered users and 51 guests