Go Down

Topic: Ethernet library reference change #2 (Read 1 time) previous topic - next topic

SurferTim

Jul 06, 2013, 02:27 pm Last Edit: Jul 06, 2013, 02:41 pm by SurferTim Reason: 1
As long as you are in the ethernet library reference, the following pages need an addition.
http://arduino.cc/en/Reference/ClientWrite
http://arduino.cc/en/Reference/ServerWrite

The pages are missing one of the most useful functions if you plan on sending any NULL (zero) bytes.
client.write(dataString,count);
server.write(dataString,count);

Parameters
dataString: the array to write (byte or char array pointer)
count: the number of bytes of the dataString array to write (int)

edit: Corrected dataString parameter to "byte or char array pointer".

SurferTim

#1
Jul 10, 2013, 01:00 pm Last Edit: Jul 10, 2013, 01:46 pm by SurferTim Reason: 1
Bump. Did you have a nice nap?

edit: Here is the library code (declarations) from EthernetClient.h
Code: [Select]
 virtual size_t write(uint8_t);
 virtual size_t write(const uint8_t *buf, size_t size);


Here is the code from EthernetClient.cpp
Code: [Select]
size_t EthernetClient::write(uint8_t b) {
 return write(&b, 1);
}

size_t EthernetClient::write(const uint8_t *buf, size_t size) {
 if (_sock == MAX_SOCK_NUM) {
   setWriteError();
   return 0;
 }
 if (!send(_sock, buf, size)) {
   setWriteError();
   return 0;
 }
 return size;
}

Federico Vanzati

Hi SurferTim,

I've edited the Client and Server write() pages, thanks for the suggestion and for noticing.
I preferred to keep the explanation close to the one given to Serial write() documentation.
Hope you like it.
F

SurferTim

That looks good to me!  :)

One down, two to go!

Federico Vanzati

One.  :)
DNS fixed. Only the UDP.stop() to go
F

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy