The reference says that if there are still unread data with a closed connection, the connected() will return true.
If this is the case for IDE 1.0.5 r2, then why did they remove the available() from the connected()?
From around Arduino IDE 1.0
uint8_t WiFiClient::connected() {
if (_sock == 255) {
return 0;
} else {
uint8_t s = status();
return !(s == LISTEN || s == CLOSED || s == FIN_WAIT_1 ||
s == FIN_WAIT_2 || s == TIME_WAIT ||
s == SYN_SENT || s== SYN_RCVD ||
(s == CLOSE_WAIT && !available()));
}
}
If there is still stuff, available() returns true and return value becomes true.
New code in 1.0.5 r2:
uint8_t WiFiClient::connected() {
if (_sock == 255) {
return 0;
} else {
uint8_t s = status();
return !(s == LISTEN || s == CLOSED || s == FIN_WAIT_1 ||
s == FIN_WAIT_2 || s == TIME_WAIT ||
s == SYN_SENT || s== SYN_RCVD ||
(s == CLOSE_WAIT));
}
}
available is removed. I have no way to test the theory that this removal creates problems. I'm supposed to report any error. I see this as a possible error or I just don't know enough. I posted the code on network board already with a related topic but thought if they want it posted on software dev. I'll do it again.