[En-Nut-Discussion] Sending broadcasts (WOL)
Hugo Simon
hugo.simon at gmx.de
Thu Oct 7 21:19:44 CEST 2004
Hi,
I want to send MagicPackets with an Ethernut to power up a PC via WakeOnLAN.
But I cannot send anything to a computer which is switched of. Ethernut
cries out some ARP requests and get no answer. As I understand that I have
to send an UDP Broadcast to my subnet. But how?
I tried to send to addres 192.168.100.0 and 192.168.100.255. Subnetmask is
255.255.255.0 and Ethernut's IP is 192.168.100.48.
No difference. Ethernet always sends ARP requests. So I think I have to say
somehow that I want to send a broadcast, but how?
Can anybody help?
Here is my sending code:
fprintf(stream,"Sending MagicPacket to %s\r\n",inet_ntoa(destIP));
u_short wolport=1000;
UDPSOCKET *udp;
udp=NutUdpCreateSocket(wolport);
if (!udp)
{
fputs("Internal error: Cannot create UDP socket",stream);
free(buffer);
return 1;
}
// for safety send the magic packet five times
NutUdpSendTo(udp, destIP, wolport, buffer,sizeof(buffer));
NutUdpDestroySocket(udp);
free(buffer);
More information about the En-Nut-Discussion
mailing list