Wake-on-LAN from a .NET Micro Framework Device

Posted by: Ajax.NET Professional, on 09 Mar 2008 | View original | Bookmarked: 0 time(s)

Well, I love the easy development of embedded devices with the .NET Micro Framework. As the device I'm currently using is really small I tried to build a small Web site on it to start my private servers at home using Wake-on-LAN. You'll find a lot of helper methods samples on the Internet but I couldn't find on source code that was working on the .NET Micro Framework. The problem is that there are too many missing methods or enum values.

Here is the source code I'm using now which is working.

public static void WakeUp(byte[] mac)
{
    using (Socket socket = new Socket(AddressFamily.InterNetwork, 
                SocketType.Dgram, ProtocolType.Udp))
    {
        IPEndPoint endPoint = new IPEndPoint(new IPAddress(4294967295), 40000);
        // IP 255.255.255.255

    socket.Connect(endPoint);

    byte[] packet = new byte[17 * 6];
    for (int i = 0; i < 6; i++)
        packet[i] = 0xFF;

    for (int i = 1; i <= 16; i++)
        for (int j = 0; j < 6; j++)
            packet[i * 6 + j] = mac[j];

    socket.Send(packet);
    }
}

Using my Web server (which I will publish this week at http://www.codeplex.com/ajaxnetmicro) including the Ajax.NET M! library it is really cool to connect to the .NET Micro Framework enabled device from outside and start your servers as you need.

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 523 | Hits: 5

Similar Posts

  • November's Toolbox Column Now Online more
  • Adding IIS Manager Users and Permissions using PowerShell more
  • My History of Visual Studio (Part 1) more
  • StreamInsight more
  • Im asked, how did you learn what you know ? more
  • VB Entity Framework Samples Now Available (Lisa Feigenbaum) more
  • NHibernate : Some Naked Thoughts more
  • You should NOT use ASP.NET MVC if. . . more
  • Visual Studio 2008 Voted Best IDE! (Lisa Feigenbaum) more
  • Sir DevFishs Crusade of Enlightenment more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD