QT uses WOL to enable remote one-click Boot (LAN, requires the target computer's motherboard support, and plug in the network cable)

Source: Internet
Author: User

Function: Let the computer shut down a key to boot, need the target computer motherboard support, and plug in the network cable;

Effect: the equivalent of manually pressing the target computer's switch button.

No technical content, simple came David ...

1. Get the target MAC address

Qbytearray smacaddr ("00-1f-16-26-d5-73");

2. Package Magic Package Chmagicpacket

Char chmacaddr[9];//should be 6 characters, but if you write 6 characters, the following sscanf_s will error, so write a large point char chmagicpacket[104]; const char *lpmacaddr=smacaddr.data (); sscanf_s (lpmacaddr, "%2x-%2x-%2x-%2x-%2x-%2x",           &chmacaddr[0],&chmacaddr[1],&chmacaddr[2],           &CHMACADDR[3],&CHMACADDR[4],&CHMACADDR[5]); memset (chmagicpacket,0xff,6); int packetsize=6; for (int i=0;i<16;i++) {     memcpy (chmagicpacket+packetsize,chmacaddr,6);        packetsize+=6; }

3. Send a magic Packet

Udpsocket.writedatagram (Chmagicpacket, 102, qhostaddress ("255.255.255.255"), 50209);

Http://www.cnblogs.com/luoxiang/p/5413096.html

QT uses WOL to enable remote one-click Boot (LAN, requires the target computer's motherboard support, and plug in the network cable)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.