You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is Issue 1030 moved from a Google Code project.
Added by 2012-09-03T18:31:07.000Z by adrian.m...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
If you close a connection before you've read all the data left in the read buffer, that data seems to stay around until the next time that socket is used, and gets incorrectly delivered as data having been read in the new connection.
You can see it happening by trying the WiFiDatastreamUpload example in the Cosm library https://github.com/amcewen/Cosm-Arduino - the first upload will succeed (or if you've not set the API key or feed id correctly, fail with a -40x error code) and subsequent attempts will fail with an error of -4 (which the HttpClient library returns if it doesn't understand the response - because it's being fed data from the previous request)
Adding a call to flush() during stop() seems to fix the problem.
void WiFiClient::stop() {
if (_sock == 255)
return;
flush();
ServerDrv::stopClient(_sock);
unsigned long start = millis();
// wait a second for the connection to close
while (status() != CLOSED && millis() - start < 1000)
delay(1);
_sock = 255;
}
The text was updated successfully, but these errors were encountered:
This is Issue 1030 moved from a Google Code project.
Added by 2012-09-03T18:31:07.000Z by adrian.m...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
If you close a connection before you've read all the data left in the read buffer, that data seems to stay around until the next time that socket is used, and gets incorrectly delivered as data having been read in the new connection.
You can see it happening by trying the WiFiDatastreamUpload example in the Cosm library https://github.com/amcewen/Cosm-Arduino - the first upload will succeed (or if you've not set the API key or feed id correctly, fail with a -40x error code) and subsequent attempts will fail with an error of -4 (which the HttpClient library returns if it doesn't understand the response - because it's being fed data from the previous request)
Adding a call to flush() during stop() seems to fix the problem.
void WiFiClient::stop() {
if (_sock == 255)
return;
flush();
ServerDrv::stopClient(_sock);
unsigned long start = millis();
// wait a second for the connection to close
while (status() != CLOSED && millis() - start < 1000)
delay(1);
_sock = 255;
}
The text was updated successfully, but these errors were encountered: