-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Successive calls to readBytes()
trigger a timeout.
#4882
Comments
Hello @jfjlaros I am just guessing here, but I think the From the description of
Thanks |
Hi @felmue thank you for looking into this. Sorry, the Without this line, the problem persists. I can also confirm that no data is discarded (with or without the |
readBytes()
trigger a timeout.readBytes()
trigger a timeout.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
Bump for stale bot. This issue is not resolved yet. |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
Bump for stale bot. This issue is not resolved yet. |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
Hi @VojtechBartoska , I tested version 2.0.3-RC1, but I see no difference in behaviour. |
Hi, Thanks for testing. I'm adding it to the roadmap and we will take a look on this more. |
Hi, i have simulated your issue between 2 ESP32s. I have used your server code and rewrite the host for ESP32.
This part takes 0000-0001 ms, but you can read wrong data. You need to wait till the data are available for every read with |
@jfjlaros Your issue can be solved by calling And as I mentioned in comment above, always read only if client.available() is true. |
After some more experimenting, the solution seems to be to set the connection._socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) I suspect Thank you very much for pointing me in the right direction. |
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.4, 1.0.5
IDE name: Arduino IDE
Flash Frequency: n.a.
PSRAM enabled: n.a.
Upload Speed: n.a.
Computer OS: Debian 10
Description:
Sucsessive calls to
readBytes()
trigger a timeout in de example below. Is there a way to avoid this, or is this perhaps a bug in one of the core libraries?When calling
readBytes()
twice in succession, the second call takes a lot longer than the first one. This behaviour seems to be occurring only when using the WiFi interface, both the Bluetooth and the Serial interface are not affected. This behaviour seems to be specific to this setup, other WiFi modules are not affected.Sketch:
Host code:
Debug Messages:
When we run the code as is, we see the following output:
Notice that
read 2
takes a long time as seen from the perspective of the Arduino, whileread
takes a long time as seen from the perspective of the host.When the offending snippets are commented out, we see the following output:
Which is expected behaviour.
The text was updated successfully, but these errors were encountered: