aboutsummaryrefslogtreecommitdiff
path: root/libraries/Ethernet/Client.cpp
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2009-04-26 13:10:34 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2009-04-26 13:10:34 +0000
commit0681fc1f177f7c94b4e98bb0931a5efda50f32b0 (patch)
tree2174000a919ea016385dac3cdb482ce2d21fee9f /libraries/Ethernet/Client.cpp
parenta42326aba2fd9696a4b2e1239a5a222014056ff5 (diff)
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.
Diffstat (limited to 'libraries/Ethernet/Client.cpp')
-rw-r--r--libraries/Ethernet/Client.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/Ethernet/Client.cpp b/libraries/Ethernet/Client.cpp
index c62e26c..51096db 100644
--- a/libraries/Ethernet/Client.cpp
+++ b/libraries/Ethernet/Client.cpp
@@ -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);
}