win universal app - How can I send WOL (UDP)? -


i can't figure out how send wol (wakeonlan) using iot.

it seams should se datagramsocket, samples can find online, uses udpclient.

how can send wol (udp) in iot?

thanks.

to send magic packet in winrt app indeed need use datagramsocket windows.networking.sockets api. basic solution i'd written while back:

public async void sendmagicpacket(string macaddress, string ipaddress, string port) {     datagramsocket socket = new datagramsocket();     await socket.connectasync(new hostname(ipaddress), port);     datawriter writer = new datawriter(socket.outputstream);      byte[] datagram = new byte[102];      (int = 0; <= 5; i++)     {         datagram[i] = 0xff;     }      string[] macdigits = null;     if (macaddress.contains("-"))     {         macdigits = macaddress.split('-');     }     else if (macaddress.contains(":"))     {         macdigits = macaddress.split(':');     }      if (macdigits.length != 6)     {         throw new argumentexception("incorrect mac address");     }      int start = 6;     (int = 0; < 16; i++)     {         (int x = 0; x < 6; x++)         {             datagram[start + * 6 + x] = (byte)convert.toint32(macdigits[x], 16);         }     }      writer.writebytes(datagram);     await writer.storeasync();     socket.dispose(); } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -