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

Change the return type of write() from void to size_t on WiFiServer class

This commit is contained in:
mlafauci
2011-09-14 00:13:31 +02:00
parent 20bea5fcc0
commit af0dd1926a
3 changed files with 13 additions and 6 deletions

View File

@ -46,13 +46,15 @@ WiFiClient WiFiServer::available(byte* status)
return WiFiClient(255);
}
void WiFiServer::write(uint8_t b)
size_t WiFiServer::write(uint8_t b)
{
write(&b, 1);
return write(&b, 1);
}
void WiFiServer::write(const uint8_t *buffer, size_t size)
size_t WiFiServer::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
for (int sock = 0; sock < MAX_SOCK_NUM; sock++)
{
if (WiFiClass::_server_port[sock] != 0)
@ -62,8 +64,9 @@ void WiFiServer::write(const uint8_t *buffer, size_t size)
if (WiFiClass::_server_port[sock] == _port &&
client.status() == ESTABLISHED)
{
client.write(buffer, size);
n+=client.write(buffer, size);
}
}
}
return n;
}