arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
259 stars 264 forks source link

No definition of BYTE_ORDER #118

Open lathoub opened 5 years ago

lathoub commented 5 years ago

This Ethernet library does not define the BYTE_ORDER of the chipset that is used, the wifi library does (as does the ESP32). I have made a suggestion here, so that the Ethernet library programmer doesn't have to reinvent it. (or should this be defined by the Arduino main library?)

SapientHetero commented 5 years ago

This could be addressed by including a comment noting that data sent to or received from the library must be in "network byte order", aka "Big-Endian", though in practice it doesn't seem necessary to worry much about it. For instance, you can declare a buffer like so:

const char page1[] = "<body><p><u><b><H1 style='margin-left: auto; margin-right: auto; text-align: center;'>Test Page</H1></b></u></p>";

and pass it to EthernetClient::write() and it sends just fine. Adding a note about Endianness would confuse many more than it would help.