void Reboot(int sockfd) {
int i;
sync();
if (( i = reboot(LINUX_REBOOT_CMD_RESTART)) !=0) {
char *buf= "failed to reboot the computer\n";
writen(sockfd,buf,strlen(buf));
}
return;
}
void Poweroff(int sockfd) {
int i;
sync();
if (( i = reboot(LINUX_REBOOT_CMD_POWER_OFF)) !=0) {
char *buf = "Failed to shutdown the remote computer\n";
writen(sockfd,buf,strlen(buf));
}
return;
int i;
sync();
if (( i = reboot(LINUX_REBOOT_CMD_RESTART)) !=0) {
char *buf= "failed to reboot the computer\n";
writen(sockfd,buf,strlen(buf));
}
return;
}
void Poweroff(int sockfd) {
int i;
sync();
if (( i = reboot(LINUX_REBOOT_CMD_POWER_OFF)) !=0) {
char *buf = "Failed to shutdown the remote computer\n";
writen(sockfd,buf,strlen(buf));
}
return;
}
重启及关机,并将信息反馈给socket