
37
PROGRAMMER'S GUIDE FOR v02.00.46
3.13.3 Livecore
TM
device MAC address
You can get the Livecore
TM
device MAC address using the Web RCS: Click the DashBoard button located
in the status bar.
Picture 22 : Web RCS DashBoard – MAC Address
You can also retrieve the MAC address by request the PCmac variable:
Syntax : <dev>,<fld>PCmac
L
F
<dev> is the device index (0 for Master device, 1 for Slave device).
<fld> is the MAC address field index (0 to 5).
3.13.4 Programming example
This .NET C# example sends a ‘magic packet’ for MAC address 00:25:90:3D:11:4A.
void SendWOLPacket(byte[] macAddress)
{
// WOL 'magic' packet is sent over UDP.
using (UdpClient client = new UdpClient())
{
// Send to: 255.255.255.0:9 over UDP (port number 9: Discard)
client.Connect(IPAddress.Broadcast, 9);
// Two parts to a 'magic' packet:
// First is 0xFFFFFFFFFFFF,
// Second is 16 * MACAddress.
byte[] packet = new byte[17 * 6];
// Set to: 0xFFFFFFFFFFFF.
for (int i = 0; i < 6; i++)
packet[i] = 0xFF;
// Set to: 16 * MACAddress
for (int i = 1; i <= 16; i++)
{
for (int j = 0; j < 6; j++)
packet[i * 6 + j] = macAddress[j];
}
// Send WOL 'magic' packet.
client.Send(packet, packet.Length);
}
}
byte[] macaddress = new byte[] {0x00, 0x25, 0x90, 0x3D, 0x11, 0x4A};
WakeOnLan(macaddress);
Commentaires sur ces manuels