How can I broadcast a WakeOnLan datapacket?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I broadcast a WakeOnLan datapacket?

Tried using Sockets but compact framework does not support broadcasting nor
connectionless sending .

Looked at IPHelper function IcmpSendEcho, but iphlpapi.dll failed to load
when using reflection.

Any suggestions?
 
Can't you send the packet to the subnets broadcast address? (http://
en.wikipedia.org/wiki/Broadcast_address)

Compact Framework does support connectionless sending, via the
Socket.SendTo method, I seem to recall I had WOL working on my WM5
device, but my router does not allow packets from the internet to the .
255 address on the LAN, so I couldn't actually turn on my machine from
the internet, although it worked great when I was connected via my
WLAN.

Matt
 
I will give this a go.

I have tried SendTo using ip 255.255.255.255 as the EndPoint, but it failed.
Not sure of the exception though.
 
this is the reported error
error code 10057
A request to send or receive data was disallowed because the socket is not
connected and (when sending on a datagram socket using a sendto call) no
address was supplied.

This happens on the local bradcast and also loopback addresses.

Socket address family is internetwork, type is stream and protocol is TCP.
Have tried raw data stream and UDP protocol, but the sockect fails to
initlise. SendTo flags does not allow broadcast.
 
That's the problem. You've opened a stream socket, not a datagram socket.
You want SocketType.Dgram, not stream.

Paul T.
 
Yep.


thankyou Paul

Paul G. Tobey said:
That's the problem. You've opened a stream socket, not a datagram socket.
You want SocketType.Dgram, not stream.

Paul T.
 
Back
Top