-
Notifications
You must be signed in to change notification settings - Fork 33
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
some very strange numbers from getLastReturnCode() #3
Comments
this looks like a rather nasyt memory problem … will look into it (promised) |
Hi there, I am facing the same problem here (Arduino Mega 2560). Any updates on this issue ? Thanks in advance, |
Same here, only in rare cases |
When I look at the code I don't know if the variable reference to the instance-variable is correct and the best way here: fscanf_P(stream, PSTR("HTTP/1.1 %i"), &lastReturnCode); maybe better to use a local variable to write it and copy that to the class member later on ?! I will change that locally and test it for some days. |
I discovered one thing: The code (especially with this fscanf) assumes that there is content to read. When there is no/not enough content to read then fscanf returns with EOF or 0 - return value of fscanf is normally the number of matched items (%i) or EOF on error. |
As an update: I've seen in my code that any time the fscanf_P was not able to match successfully the details are the same:
I will add debug output of "errno", but at least this is not set in HTTPClient class ... I will also try to make an available-loop till at least x characters are available before starting to read ... Will update here ... |
Next update:
After many tries I assumed a timing issue with receiving the data from remote ... so I tried to add a "delay(100)" to simply give it more time to receive the data (not ideal, but a first try) and hey ... no more problems since two days ... |
So, after a month of having it working without problems ... I removed all debugging stuff and committet it. See pull request #15 or my fork at https://github.com/Apollon77/HTTPClient |
With merging my pull request this issue hopefully can be closed |
Also, I seem to be getting some very strange numbers from getLastReturnCode(). The debugging prints show status 200, but getLastReturnCode is giving me varying numbers, even negative numbers:
1300
513
2
512
-236
1024
etc.. There seems to be no fixed pattern
The text was updated successfully, but these errors were encountered: