mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-20 21:01:25 +03:00
Adding write(str) and write(buf, size) methods to Print class and Ethernet library Client and Server classes. This allows sending a whole string or buffer at once, reducing the number of ethernet packets.
This commit is contained in:
@ -2,6 +2,7 @@ extern "C" {
|
||||
#include "types.h"
|
||||
#include "w5100.h"
|
||||
#include "socket.h"
|
||||
#include "string.h"
|
||||
}
|
||||
|
||||
#include "Ethernet.h"
|
||||
@ -50,6 +51,14 @@ void Client::write(uint8_t b) {
|
||||
send(_sock, &b, 1);
|
||||
}
|
||||
|
||||
void Client::write(const char *str) {
|
||||
send(_sock, (const uint8_t *)str, strlen(str));
|
||||
}
|
||||
|
||||
void Client::write(const uint8_t *buf, size_t size) {
|
||||
send(_sock, buf, size);
|
||||
}
|
||||
|
||||
int Client::available() {
|
||||
return getSn_RX_RSR(_sock);
|
||||
}
|
||||
|
Reference in New Issue
Block a user