1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Allow setting TCP timeout

This commit is contained in:
Denver Abrey
2015-12-27 19:45:17 +02:00
parent 7a010a38cc
commit d1a6b32133
2 changed files with 13 additions and 3 deletions

View File

@ -50,6 +50,7 @@ HTTPClient::HTTPClient() {
_returnCode = 0;
_size = -1;
_canReuse = false;
_tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
}
@ -252,6 +253,14 @@ void HTTPClient::setAuthorization(const char * auth) {
}
}
/**
* set the timeout for the TCP connection
* @param timeout unsigned int
*/
void HTTPClient::setTimeout(uint16_t timeout) {
_tcpTimeout = timeout;
}
/**
* send a GET request
* @return http code
@ -673,7 +682,7 @@ bool HTTPClient::connect(void) {
}
// set Timeout for readBytesUntil and readStringUntil
_tcp->setTimeout(HTTPCLIENT_TCP_TIMEOUT);
_tcp->setTimeout(_tcpTimeout);
#ifdef ESP8266
_tcp->setNoDelay(true);