Zohar Posted February 19, 2014 Posted February 19, 2014 (edited) Hi I created a small application for Android, that Sends Commands to my computer, and on my computer, an AutoIt script that receives the commands(via TCP), and then runs the appropriate code for it. There are several nice commands, and now I want to add 2 more: - Sleep - Wake from sleep There's no problem to implement Sleep, it's done via Shutdown(32) ;32=Standby Now the problem is how to Wake the computer.. Usually the normal way to wake the computer is either pressing a key on the keyboard, or moving the mouse. But what if you want to wake the computer, without using the Keyboard or Mouse, but when being able to send TCP/UDP? Is there a way for that? Or am I stuck only with being able to implement Sleep, without Unsleep.... Thank you Zohar Edited February 19, 2014 by Zohar
FireFox Posted February 19, 2014 Posted February 19, 2014 Hi, Did you test if the script receives your tcp commands ? (e.g : write in a file or in the console) Br, FireFox.
Zohar Posted February 19, 2014 Author Posted February 19, 2014 (edited) Hi I did not test, because naturally I expect my script not to run during sleep - the whole computer is asleep.. So the WakeUp code should not be something that I do in my code, but more like a standard way(if exists) to wake a computer via the Local network.. (an which should be handled by the BIOS for example) I remember there's a WOL signal, tthat is used to Turn On a computer... Maybe there's something similar for Waking from sleep? Edited February 19, 2014 by Zohar
FireFox Posted February 19, 2014 Posted February 19, 2014 (edited) You can still document yourself on this and replicate the signal, but like you said it won't be your script which will handle the signal. Edited February 19, 2014 by FireFox
Zohar Posted February 19, 2014 Author Posted February 19, 2014 (edited) what do you mean by "document yourself"? >but like you said it won't be your script which will handle the signal. I on't really care who will be the direct waking up agent, as long as it is does after a button press on my Anroid Phone... That's what I'm trying to achieve Since m phone is not connected to the computer like a Keyboard or a Mouse, but only via Wi-Fi, via my LAN router, then anything that can come from my Router, and can wake a sleeping computer, will be great. Edit: I went to Wikipedia to read about WOL, for turning on the computer, to see if it mentions anything about waking from sleep.. and it says: "Wake-on-LAN (WOL) is an Ethernet computer networking standard that allows a computer to be turned on or awakened by a network message." Awakening is included... so this is a good thing for my needs I will test it now to see if it works..... Edited February 19, 2014 by Zohar
FireFox Posted February 19, 2014 Posted February 19, 2014 I meant search on the internet to find out how to replicate the signal, or if someone passes to help you.
Gianni Posted February 19, 2014 Posted February 19, 2014 Hi I use >this simple script and it works (don't know if it awake a pc from sleep) you can have a look to it to study how it works Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Zohar Posted February 19, 2014 Author Posted February 19, 2014 (edited) OK I have some updates. I downloaded a WOL app for Android, there are quite many, here's one for example, called SimpleWOL: https://play.google.com/store/apps/details?id=com.sbrsoft.simplewol I then tested it on my computer, while it was in Sleep mode. It did not work. I then decided to test it on my computer when it was Turned Off. It then worked very well. So it means that my computer can WOL when it's turned off, but not WOL when it's in Sleep mode. I wonder if there's any change I can do t my computer, that can make it WOL also when in Sleep mode.. If anyone has an idea, it will be great. Maybe I should change some setting in my OS? (Windows XP SP3) I know Windows XP is not running when I am in sleep mode, but maybe before it send the computer to sleep mode, it tells the BIOS something, regarding how to wake? Hi I use >this simple script and it works (don't know if it awake a pc from sleep) you can have a look to it to study how it works Hi PincoPanco Thank you, this is a very nice implementation for the Client - the computer that Wakes the other computer. That thread also contains a shorter and cleaner implementation.. here: It is also explained in Wikipedia, how to do it: http://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet It's quite simple: Send a UDP Packet to the IP of the computer, on Port 9, where the UDP content should be this: 6 bytes of all 255 (FF FF FF FF FF FF in hexadecimal), followed by sixteen repetitions of the target computer's 48-bit MAC address, for a total of 102 bytes. Edited February 19, 2014 by Zohar
Zohar Posted February 19, 2014 Author Posted February 19, 2014 (edited) Update: Apparently there is something that should be done in the OS: We need to go to: Control PanelNetwork Connections, then Rightclick the Local Area Network connection, and choose Properties, then press the "Configure..." button on the top of the window, then in the new window that opens, goto the "Power Management" tab: and there, we need to select "Allow this device to bring the computer out of standby". Tho I must say the warning they write in the end is quite scary.. Does it do this behavior(waking up periodically) with all computers, or only older ones? Edited February 19, 2014 by Zohar
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now