mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-14 08:03:09 +03:00
write(), print(), and println() now return number of bytes written.
The type is long, and negative values indicate errors. Needs more testing. http://code.google.com/p/arduino/issues/detail?id=551
This commit is contained in:
@@ -70,19 +70,18 @@ int Client::connect(IPAddress ip, uint16_t port) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Client::write(uint8_t b) {
|
||||
if (_sock != MAX_SOCK_NUM)
|
||||
send(_sock, &b, 1);
|
||||
long Client::write(uint8_t b) {
|
||||
return write(&b, 1);
|
||||
}
|
||||
|
||||
void Client::write(const char *str) {
|
||||
if (_sock != MAX_SOCK_NUM)
|
||||
send(_sock, (const uint8_t *)str, strlen(str));
|
||||
long Client::write(const char *str) {
|
||||
return write((const uint8_t *) str, strlen(str));
|
||||
}
|
||||
|
||||
void Client::write(const uint8_t *buf, size_t size) {
|
||||
if (_sock != MAX_SOCK_NUM)
|
||||
send(_sock, buf, size);
|
||||
long Client::write(const uint8_t *buf, size_t size) {
|
||||
if (_sock == MAX_SOCK_NUM) return -1;
|
||||
if (!send(_sock, buf, size)) return -2;
|
||||
return size;
|
||||
}
|
||||
|
||||
int Client::available() {
|
||||
|
Reference in New Issue
Block a user