-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host Wake-On-LAN #126
base: master
Are you sure you want to change the base?
Host Wake-On-LAN #126
Conversation
…tempt to wake a device. Need to test on a device thats not my host and client.
…and find out why its not working
… reintroduce the early return if the computer doesn't need to be woken
if (host == nullptr || host->Connected) return; | ||
|
||
if (host->MacAddress == nullptr || host->MacAddress == "00:00:00:00:00:00") { | ||
Utils::Log("No recorded Mac address, the client and host must be connected at least once.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be paired, not just connected once.
You can check https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.contentdialog?view=windows-app-sdk-1.5 if you want a more interactive option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the message for now, doesn't feel right opening a dialog box from the state, might have a rethink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some blocking changes before testing
return; | ||
} | ||
|
||
std::string hostIP = Utils::PlatformStringToStdString(host->LastHostname).substr(0, 14); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might not be sure that LastHostname is a correct IP address. It might be a domain name or the local computer name. Only mDNS adds the machine via the IP address
} | ||
|
||
std::string hostIP = Utils::PlatformStringToStdString(host->LastHostname).substr(0, 14); | ||
std::string broadcastIP = (hostIP.substr(0, hostIP.length() - 3) + "255"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic for handling the broadcast IP is wrong. I think you might want to check https://github.com/moonlight-stream/moonlight-qt/blob/ebe270bec5820b956f4c511fd31097a0c1d1a7c3/app/backend/nvcomputer.cpp#L216 to handle it better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use the both the https://github.com/TheElixZammuto/moonlight-xbox/blob/d622fe15e9bf591a97a7c69db0bb7ee4f132df61/State/MDNSHandler.cpp and https://learn.microsoft.com/en-us/uwp/api/windows.networking.connectivity.ipinformation.prefixlength?view=winrt-22621#windows-networking-connectivity-ipinformation-prefixlength property to correctly get the local IP address and the broadcast IP address
Co-authored-by: TheElixZammuto <theelixzammuto@gmail.com>
Co-authored-by: TheElixZammuto <theelixzammuto@gmail.com>
Quality Gate passedIssues Measures |
Are there any updates on this PR? I would love to use Wake-on-LAN from Moonlight on my Xbox. 😊 |
any updates? thanks for helping.. |
Any updates? Happy to jump in and take over if there are blocking changes that are not being addressed. |
Add an option to wake host by sending a magic packet to its last known IP and the usual broadcast IPs.
I had to retrieve the MacAddress from the server info, so this will only work after the host / client have been connected since this update. Warnings and errors are just sent to logging, wasn't sure if we should pop an error message or if we should hide the button if the host is connected / reachable.
Magic packet is constructed with 6 0xFF chars followed by 16 mac addresses (in base 16 decimal). This can't be tested using a local machine as the server info doesn't retrieve the mac address, but tested using my laptop fine.
Feel free to edit and thanks for creating this project.