-
Notifications
You must be signed in to change notification settings - Fork 7.6k
peek() in Stream class problem #329
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
Comments
Ahhh took me a while to track it down ;) You mean that it was not implemented right on the WiFiClient class. |
Now peek() will return -1. This didn't solve the issue. I ran into this problem when I was testing ThingSpeak for ESP32. WriteFields() call sends the data to ThingSpeak server and data is successfully published, but there is an error when it tries to parse response because it is unable to read integer code of the response. ThingSpeak tries to parse integer from response received, starting from the position in the stream where it finds "HTTP/1.1". If peek() method returns -1, then parseInt()->peekNextDigit()->timedPeek()->peek() calls in Stream class will always return 0, i.e. result is interpreted as timeout. WiFiClient is not able to properly execute the parseInt() method. peek() method for ESP8266 have implementation in ClientContext class. It have access to receive buffer and it returns byte from current position of the buffer. |
Yes, but on ESP32 things are different and we use the POSIX API to access the network. I'm not sure that we can peek at the data with POSIX. |
I think this will work. I'm getting correct answer from parseInt() method now.
I found this description on http://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html "MSG_PEEK |
@me-no-dev Thanks |
yes, sorry I'm otherwise preoccupied with work. If you have tested this and it works, please do submit a PR. It will be much easier for me to merge it :) |
implemented! |
Hi all,
I have found that peek() method is not implemented properlly in Stream class. It returns 0.
I discovered this when I was testing ThingSpeak functionality. Response code is obtained by trying to parseInt() within response form server and this is where application get stuck.
The text was updated successfully, but these errors were encountered: