Monday, March 28, 2011

Api to turn on your computer

I'm Making a small on-line clock (both for fun and to learn a bit more of php and javascript) started it because i actualy need an alarm clock and this would be easier than buying one (don't ask)

Now i wanted to know one thing, i know it's impossible to turn on/off you're computer from a browser, but a friend asked me if i could do him a small addon/program that would fetch the alarm time he added there, and would turn his computer on so it would let if wake up

I know turning on must be pretty much impossible, but turning on from sleep/hibernate maybe?

Anyone knows any api to do this? Windows or mac, or cross platform.

Just for curiosity the alarm clock is here http://www.my-clock.net

Edit:

On the wiki page, wake-on-lan says it requires to turn the bios power to the network-board, is there any way arround this? Or are todays computers already ready for this kind of protocol?

From stackoverflow
  • I don't know a lot about how it works, but it sounds like you need Wake-on-LAN

    Wake on LAN (WOL, sometimes WoL) is an Ethernet computer networking standard that allows a computer to be turned on or woken up remotely by a network message.

  • Your best bet may be Wake-on-LAN

  • As people have pointed out, Wake-On-Lan is one possibility. But there's another one that might suit your need. Most BIOS'es today already provide an option to turn your computer on at a given time. If your goal is simply to turn your computer into an alarm clock, this should do the trick.

  • Once a OS goes in hibernate/sleep the only way to bring it up is through some kind of kernel level hardware driver event. for example pressing power button or opening the lid of the system etc.

    IMO it would be bit complex to model the functionality within an application, as application is dependent on OS level services, that are not available in sleep/hibernate mode.

  • There could be two solutions:

    1. Use Wake-on-LAN as was suggested. But you must have another machine up on that LAN, it doesn't work over the Internet itself. So it goes like You -> [Internet] -> Waker -> Your friend.
    2. You can set his RTC wakeup alarm over the Internet while his machine is still up and running. Then his computer will wake at the specified time.

    Both would work even if the computer is completely powered-off.

0 comments:

Post a Comment