I’m trying to get WakeupOnLan working from the Arduino Mega + Ethernet card (I’ve attached my test code)
The problem that I’m hitting is that in attempting to write 16 copies of the mac address (6 bytes) to the Udp buffer, it occasionally returns 2048 for the size written (I’ve reduced the number of mac frames from the normal 16 to 3, so that it succeeds sometimes - I can see it succeed/fail on the network monitor that I have running on another PC) If 2048 occurs, then the packet is not sent.
I’ve looked at the library code for Udp::write() and it seems that the 2048 is the TX buffer free size which is returned if the requested write length exceeds the W5100 TX buffer free size.
So I’ve only written 3 *6 bytes and yet it thinks that the following 6 bytes will cause the buffer to overflow !! I even tried a Udp.flush() beforehand, but the problem remains
I’m sure this is something silly, that someone will point out the glaring mistake, and I’ll kick myself !!
All suggestions will be appreciated !
WakeOnLan.cpp (1.41 KB)
WakeOnLan.h (412 Bytes)
WakeOnLanExample.ino (789 Bytes)