public void OldAPI() { string ip = GetValue(listBox1.SelectedItem.ToString() + clear.Name.ToString() + "IP"); string rely = getMib(GetValue(listBox1.SelectedItem.ToString() + clear.Name.ToString() + "RELY")); int result = SNMP_SET(ip, 161, rely, adventnet.snmp.snmp2.SnmpAPI.INTEGER, "0", "private"); LogClass.WirteLine("ip=" + ip + ",port=161,mib=" + rely + ",adventnet.snmp.snmp2.SnmpAPI.INTEGER=" + adventnet.snmp.snmp2.SnmpAPI.INTEGER + ",setvalue=1,community=private"); }
public void NewAPI(string relay, string code) { Socket server = null; EndPoint point = null; try { server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); point = new IPEndPoint(IPAddress.Parse(ip), 2701); string msg = $"pin set k{relay} {code};"; //string msg = "H8-00033-k2-on"; server.SendTo(Encoding.UTF8.GetBytes(msg), point); } catch (Exception e) { LogClass.WirteLine($"Socket error , {e.ToString()}"); } }