1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-25 06:22:11 +03:00

TCP client flow control

This commit is contained in:
Ivan Grokhotkov
2014-12-29 01:20:07 +03:00
parent 54436ffd6b
commit 55f07f1e08
2 changed files with 99 additions and 20 deletions

View File

@ -36,6 +36,7 @@ int ICACHE_FLASH_ATTR Stream::timedRead()
do {
c = read();
if (c >= 0) return c;
yield();
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
@ -48,6 +49,7 @@ int ICACHE_FLASH_ATTR Stream::timedPeek()
do {
c = peek();
if (c >= 0) return c;
yield();
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}