Forums

 
HomeHomeRoyal TS V 1.xRoyal TS V 1.xToolboxToolboxWake on LAN for servers (including code snippet)Wake on LAN for servers (including code snippet)
Previous
 
Next
New Post
10/21/2008 9:13 PM
 

Hey,

It would be nice if a MAC address field could be added to the server properties dialog, and then a button to wake it using Wake on LAN.

Here is a code snippet that I have been using to wake clients over the network, feel free to use it as you like (and everyone else for that matter):

-----------------------------------

String[] sections;
byte[] mac = new byte[6];

try
{
    sections = txtMacAddress.Text.Split(":".ToCharArray());
    if (sections.Length != 6)
        throw new Exception();

    for (int i = 0; i < mac.Length; i++)
        mac[i] = byte.Parse(sections[i], System.Globalization.NumberStyles.HexNumber);
}
catch (Exception)
{
    MessageBox.Show(this, "Cannot parse input", "Error paring", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
}

UdpClient client = new UdpClient();
client.Connect(IPAddress.Broadcast, 40000);

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];

client.Send(packet, packet.Length);

 
New Post
10/21/2008 9:28 PM
 

That's a fantastic idea! And thanks for doing all the work, btw

Would you be willing to test such an implementation?

 

cheers


Stay in touch with code4ward.net:

Subscribe to our Blog RSS FeedFollow us on TwitterLike us on FacebookOur Google+ page
 
New Post
10/21/2008 9:42 PM
 

Sure, just send me a link to an installer :)

The code is something that I wrote in a few minutes a while ago, so there isn't much errorhandling, but it shouldn't be too difficult to add proper error handling to it.
I haven't tested it with multiple interfaces yet though :)

 
New Post
10/28/2008 2:09 PM
 

what about extending it with a feature where the WOL monitors when the server/workstation comes alive.

It could display this with a small icon changing from red to green when the server/workstation reply's to ping

 
New Post
11/4/2008 3:44 PM
 

If/when Wake on LAN gets into Royal TS, I would like to test it.    This would be very useful.

Would it be possible to allow for an alternative WOL program/script to be called?  I currently use WOL from http://www.simply-ware.com/WolHelp.htm .

Thanks,

Steve.

 
New Post
11/5/2008 10:34 AM
 

I just made up my mind how the first (and rough) implementation could be. I am thinking about some sort of task execution in a very simple way. There may also be no GUI for setting up these tasks in the first release. In this case an XML file needs to be edited. The idea is, that you define a task, like:

"ping.exe $HostName$ -t" or

"someotherkindof.exe $HostName$"

The $HostName$ will be substituted with the current selection. Most of the other fields may be available as well.

Would this solution solve your WOL problem?

What do you think?


Stay in touch with code4ward.net:

Subscribe to our Blog RSS FeedFollow us on TwitterLike us on FacebookOur Google+ page
 
New Post
11/5/2008 4:16 PM
 

For WOL programs, some take the mac address as a parameter and not the hostname.  In the case of the WOL program I use, it takes the mac address without hyphens or colons, so the command to wake up a system is simply:  wol 00AABBCCDDEE

I don't mind editting xml to include mac addresses until a time when Royal TS can populate the XML either by automatically collecting mac addresses or via user input such as via the add/edit connection properties windows.

BTW - I only signed up to this forum the other day, but I've been quietly using Royal TS for several months now and I would just like to say thanks Stefan - it's a very good and useful product

Regards,

Steve.

 
New Post
11/5/2008 5:26 PM
 

With editing the XML I was more talking about the configuration of "external" tasks rather than the MAC address. I completely forgot that this info is needed for that. So we either need an additional field for the MAC address or we "hijack" the description field for that. Do you use descriptions?

cheers

Stefan


Stay in touch with code4ward.net:

Subscribe to our Blog RSS FeedFollow us on TwitterLike us on FacebookOur Google+ page
 
New Post
11/6/2008 10:03 AM
 

Yes I use descriptions and I'm ok with using the field for anything such as mac addresses.

 
New Post
1/6/2009 12:17 PM
 

For those who need WOL, Royal TS 1.6.0 now features custom tasks to execute agains a connection and an additional field for the physical address was implemented too.

cheers

Stefan


Stay in touch with code4ward.net:

Subscribe to our Blog RSS FeedFollow us on TwitterLike us on FacebookOur Google+ page
 
Previous
 
Next
HomeHomeRoyal TS V 1.xRoyal TS V 1.xToolboxToolboxWake on LAN for servers (including code snippet)Wake on LAN for servers (including code snippet)


spacer
dummy