void pollNetwork() { UdpClient udp = NewBroadcastUDP(); byte[] packet = PacketBuilder.BuildHeader(new byte[] { 0x05 }); udp.Send(packet, packet.Length); udp.EnableBroadcast = false; udp.Close(); }
public void changeIP(DetectedPLC plc, IPAddress IP) { byte[] ip = IP.GetAddressBytes(); UdpClient udp = NewBroadcastUDP(); byte[] data = { 0x15, plc.MAC[0], plc.MAC[1], plc.MAC[2], plc.MAC[3], plc.MAC[4], plc.MAC[5], 0x0c, 0x00, 0x10, 0x00, ip[0], ip[1], ip[2], ip[3] }; byte[] packet = PacketBuilder.BuildHeader(data); udp.Send(packet, packet.Length); udp.EnableBroadcast = false; udp.Close(); }
void requestIP(DetectedPLC plc) { UdpClient udp = NewBroadcastUDP(); byte[] data = new byte[11]; data[0] = 0x15; Array.Copy(plc.MAC, 0, data, 1, plc.MAC.Length); data[7] = 0x0b; data[9] = 0x10; byte[] packet = PacketBuilder.BuildHeader(data); udp.Send(packet, packet.Length); udp.Close(); }
public void changeIP(byte[] MAC, byte[] ip) { if (ip.Length != 4) { throw new Exception("IP must contain exactly four bytes!"); } if (MAC.Length != 6) { throw new Exception("MAC must contain exactly six bytes!"); } UdpClient udp = NewBroadcastUDP(); byte[] data = { 0x15, MAC[0], MAC[1], MAC[2], MAC[3], MAC[4], MAC[5], 0x0c, 0x00, 0x10, 0x00, ip[0], ip[1], ip[2], ip[3] }; byte[] packet = PacketBuilder.BuildHeader(data); udp.Send(packet, packet.Length); udp.EnableBroadcast = false; udp.Close(); }