I'm programming a wake on LAN program for our company. There are ca. 40-50 machines in our company and it should wake up every client. To wake up the clients I use this code:
private static void WakeUp(string macAddress)
{
    WOLClass client = new WOLClass();
    client.Connect(new IPAddress(0xffffffff), 0x2fff);
    client.SetClientToBroadcastMode();
    int counter = 0;
    byte[] bytes = new byte[1024];
    for (int e = 0; e < 6; e++)
    {
        bytes[counter++] = 0xFF;
    }
    for (int e = 0; e < 16; e++)
    {
        int i = 0;
        for (int w = 0; w < 6; w++)
        {
            bytes[counter++] = byte.Parse(macAddress.Substring(i, 2), NumberStyles.HexNumber);
            i += 2;
        }
    }
    int returnedValue = client.Send(bytes, 1024);
}
public class WOLClass : UdpClient
{
    public WOLClass()
        : base()
    {
    }
    public void SetClientToBroadcastMode()
    {
        if (this.Active)
        {
            this.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 0);
        }
    }
}
and on button_Click event I just call the method WakeUp(macAddress)
Most clients wake up normally. But on some clients the computer just stops starting and stays in a black monitor with a little underline in the upper left corner. I already checked the macAddress for every client 3 times (ipconfig) and also in debug mode of VS2012. It's always identical and correct. So it cannot be a mac address issue.
Does someone know that problem?
Suggestions appreciated :)