Click here to Skip to main content
12,255,210 members (58,963 online)
Click here to Skip to main content

Stats

120.3K views
2K downloads
81 bookmarked
Posted

Wake-On-Lan Class

, 27 Oct 2003
Class to wake up a remote machine by sending a Wake-On-Lan packet.
using System;
/* (c)2003 M.Kruppa */
namespace NetTools
{
	/// <summary>
	/// Summary description for WakeUp class
	/// This is the comand line application class for Wake-Up-On-Lan using MagicPacket Class.
	/// </summary>
	class WakeUp
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			string macAdress; 
			int byteSend;
			Console.WriteLine("WakeUp\n"
				+"Copyright(C)2003 by M. Kruppa <code@mkruppa.com>\n");
				
			//reading comand line arguments
			if ((args.Length != 0) && ((args[0].Length == 12) || (args[0].Length == 17)))
			{
				macAdress = args[0];
				//create MagicPacket(TM)
				MagicPacket wakeUpPacket = new NetTools.MagicPacket(macAdress);
				//wake up machine
				byteSend = wakeUpPacket.WakeUp();
				Console.WriteLine("{0} Byte Send to {1}", byteSend, wakeUpPacket.macAddress);
			}
			else 
			{
				Console.WriteLine("Usage: WakeUp <MAC>\n"
					+"Example: WakeUp A1:B2:C3:D4:E5:F6");
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

mkruppa
Team Leader
Germany Germany
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160426.1 | Last Updated 28 Oct 2003
Article Copyright 2003 by mkruppa
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid