Wake on Lan, means powering on a computer remotely by sending a data packet known as a magic packet. For this to work, the network card must have enabled the feature: “Power on Lan” or “Power on PCI Device“, which is done by accessing the BIOS of the machine.
MagicPacket format:
6 * 255 or (0xff)
16 * MAC Address of target PCIn C/C++ you can create a packet like this
unsigned char tosend[102];
unsigned char mac[6];/** first 6 bytes of 255 **/
for(int i = 0; i < 6; i++) {
tosend[i] = 0xFF;
}
/** store mac address **/
mac[0] = 0×00;
mac[1] = 0×17;
mac[2] = 0×31;
mac[3] = 0×42;
mac[4] = 0×45;
mac[5] = 0×27;
/** append it 16 times to packet **/
for(int i = 1; i <= 16; i++) {
memcpy(&tosend[i * 6], &mac, 6 * sizeof(unsigned char));
}
How to send
The magic packet must be sent over UDP protocol to port 7 or 9, the ladder being the most used. Sending the packet to a computer in the same subnetwork is pretty easy. You just have to specify the broadcast address of you network, which usually ends with *.255.
int udpSocket;
struct sockaddr_in udpClient, udpServer;
int broadcast = 1;udpSocket = socket(AF_INET, SOCK_DGRAM, 0);
/** you need to set this so you can broadcast **/
if (setsockopt(udpSocket, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof broadcast) == -1) {
perror(“setsockopt (SO_BROADCAST)”);
exit(1);
}
udpClient.sin_family = AF_INET;
udpClient.sin_addr.s_addr = INADDR_ANY;
udpClient.sin_port = 0;bind(udpSocket, (struct sockaddr*)&udpClient, sizeof(udpClient));
/** …make the packet as shown above **/
/** set server end point (the broadcast addres)**/
udpServer.sin_family = AF_INET;
udpServer.sin_addr.s_addr = inet_addr(“192.168.1.255″);
udpServer.sin_port = htons(9);/** send the packet **/
sendto(udpSocket, &tosend, sizeof(unsigned char) * 102, 0, (struct sockaddr*)&udpServer, sizeof(udpServer));
The target computer should now be up and running!
Sending the magic packet over internet behind a NAT is a bit tricky, but simpler to code.
If the target computer sits behind a router which enables port forwarding to the broadcast address, then the process in sending the magic packet resembles the steps above. just replace local broadcast address with the public broadcast address of the router and set up port forwarding to route UDP packets on port 9 to the internal broadcast ip.
If the router doesn’t support the above mentioned feature your not screwed
. For this to work, the target computer must not be turned off, but in standby or sleep mode and with the network card set up as to allow any network activity to bring it back online. This can be easily done by changing the advanced setting of the card in Windows Device Manager.
Forward UDP data on any port to that machine by tweaking the router, and send the magic packet to the public ip of the router on the forwarded port, without the need to set up the socket as to broadcast data.
this should also wake up the machine.
This was written in a hurry. ask questions if something is not understood!.
When i first listened to Evanescence i thought Bring Me To Life was their best track ever. That changed the moment i heard The Last Song I’m Wasting On You. This track wasn’t released officially; to bad though.
So, being a piano enthusiast, i decided to do a piano cover. I’m a beginner so don’t expect to much. Below is the end result:
The song was recorded in FL Studio 9 using M-Audio Keyrig 49 and a Quik Lok PS-25 sustain pedal.
The music sheet i used can be found here:
http://evanescencereference.info/wiki/index.php?title=The_Last_Song_I’m_Wasting_On_You
It’s the Kelly Thomas version
Today i was searching youtube for Beethoven’s Moonlight Sonata (you know…. that piece of classical music that everyone likes but no one has it on their computer, or mp3 player) and i stumbled upon this:
Well, this video is about some guy playing the above piece of music while playing a game the same time. And this game it’s called Synthesia. And i must say…. it’s fabulous!!!
The game has the same principles as all the games in the Guitar Hero series (actually Synthesia was called Piano Hero, until someone from Activision noticed it and threaten to sue the creator Nicholas Piegdon for using that name. You can read all about it on the official website); except that you don’t use a guitar or gamepad to controll the game. Instead you make use of a midi keyboard or your regular computer keyboard to play the notes that fall from the top of the screen
. If you hit them in time you get points if not…. maybe reduce the speed of the falling notes or give up.
The game has enough tracks to play with, ranked from easy to hardest (or harder? i don’t remeber) and the best part of it, you can add more by downloading midi files and stuff them in a folder where Synthesia can read from.
The game is free for download, but if you want more features like additional tracks and music notation you have to pay $18 to unlock a Leaning pack. It’s a reasonable price considering the tone of songs and fun you’ll have.
Official website: http://www.synthesiagame.com/
P.S. The program doesn’t support ASIO, so if you are using a regular soundcard you will most likely experience some delay with your midi keyboard, but don’t worry, there’s a fix right here:
https://www.synthesiagame.com/forum/viewtopic.php?f=4&t=348
Have fun
While searching for new music i found this: Ektoplazm: Free Music Portal and Psytrance Netlabel.
The site has some nice tracks released under the Common Creative License, meaning that you can legally download for free.
Below are some artists that i think are worth mentioning:
Hope you enjoy it, and make sure you spread the word!
Today i got one of the most annoying windows xp error: the one that says that you can’t delete or move the damn file of folder, because the stupid thing is in use. Arghhh…
The stupidest part of it all was the fact that the damn file was a text file; not a dll, or an executable; a fucking text file. So, after bashing my keyboard a few times with my mouse, i started to look for some kind of software that can unlock the file so i could delete it afterwards.
Enter Handle!
Handle is a nice little utility that runs from the command line and shows (among other things) the windows process that uses the file in question.
You can get “handle” from here. After downloading the package, i would advise you to copy handle.exe in the windows folder, so you won’t have to type the full path to the utility each time you want to run it.
Usage:
Let’s say you have a file called locked.tmp, that is in use and you can’t do anything about it, but you really really do want to delete the fucker. Open a command line window and type:
handle locked.tmp
The result of the operation should output the process name and the process identifier (PID). To be able to have full control of your file or folder, you first need to kill or terminate that process.
To do this you can use Task Manager (be sure you match the PID you got from running the handle command, to the PID in the Task Manager window, or it won’t work) or type this in the command line window:
taskkill /PID [pid]
where, “[pid]” is the process identifier displayed by the handle command.
This should kill the program that will not free your file/folder, and then you should be able to move it or delete it. But don’t take my word for it
Be sure you actually know what your are killing, before doing so, or you could end up rebooting your machine and figuring out that your car is on fire, or stuff like that. So be carefull!

