华为服务器开机启动项怎么设置_远程开机怎么设置??

我用的是win10最新版本,进入BIOS后该怎么设置远程开机??请求各位大佬告诉我,已经困恼好久了,电脑上我也设置了,还是开不了机,代码在下面,请各位一定要告诉我呀

f00c7adfeea84353c61cc211efd3f022.png

92d0d98a9625b6f7e543ac3cd34d9197.png

e5b38b90763864f126f45b90842504a0.png

039a84ac7204f24b4af8844545cabc52.png

39900fc4665765e942efa24055ad5bc1.png

2ecc7cfd60a731a075436eab93447b3a.png

主要发包代码:

int CRemoteControl::Startup(char *chMac)

{

//判断Mac地址格式

for (char *a=chMac; *a; a++)

{

if (*a != '-' && !isxdigit(*a))

{

OutputDebugStringA("Mac address must be like this: 00-d0-4c-bf-52-ba");

return -1;

}

}

//字符串转数组

int dstaddr[6];

int i = sscanf(chMac, "%2x-%2x-%2x-%2x-%2x-%2x", &dstaddr[0], &dstaddr[1], &dstaddr[2], &dstaddr[3]

, &dstaddr[4], &dstaddr[5]);

if (i != 6)

{

OutputDebugStringA("Invalid mac address!");

return -1;

}

//构造Magic Packet (包格式: "FFFFFFFFFFFF" + 重复16编mac地址)

unsigned char ether_addr[6];

for (i=0; i<6; i++)

{

ether_addr[i] = dstaddr[i];

}

u_char magicpacket[200];

memset(magicpacket, 0xff, 6);

int packetsize = 6;

for (i=0; i<16; i++)

{

memcpy(magicpacket+packetsize, ether_addr, 6);

packetsize += 6;

}

//创建广播套接字

WSADATA WSAData;

if (WSAStartup(MAKEWORD(2, 0), &WSAData) != 0)

{

OutputDebugStringA("WSAStartup failed");

return -1;

}

SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);

if (sock == INVALID_SOCKET)

{

OutputDebugStringA("Socket Create error");

return -1;

}

BOOL bOptval = TRUE;

int iOptLen = sizeof(BOOL);

if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&bOptval, iOptLen) == SOCKET_ERROR)

{

OutputDebugStringA("setsocketopt error!");

closesocket(sock);

WSACleanup();

return -1;

}

sockaddr_in to;

to.sin_family = AF_INET;

to.sin_port = htonl(0);

to.sin_addr.S_un.S_addr = htonl(INADDR_BROADCAST);

//发送魔法包

if (sendto(sock, (const char*)magicpacket, packetsize, 0, (const struct sockaddr*)&to, sizeof(to)) == SOCKET_ERROR)

{

OutputDebugStringA("Send error!");

}

else

{

OutputDebugStringA("Send success!");

}

closesocket(sock);

WSACleanup();

return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值