The function is used to modify the IP addresses of controllers through the UDP broadcast method. For security purposes,
only the IP addresses, subnets, and gateways of the access controllers with no passwords specified can be modified.
[in]: Communication modes employed in search of access controllers: UDP (or Ethernet) in this example.
[in]: Broadcast address; the default value is 255.255.255.255.
[in]: The buffer is used to save the MAC addresses and new IP addresses of the target device.
Configure subnet masks and gateways according to current network, except for IP addresses.
When the returned value is 0 or a positive value, it indicates the number of records for the received data.
When the returned value is a negative value, it indicates that the operation fails. Attached table 5 lists
the information about the error codes.
None
[DllImport("plcommpro.dll", EntryPoint = "ModifyIPAddress")] public static extern int ModifyIPAddress(string commtype, string address, string buffer); private void ModifIP() { Connect_Pull(); int ret = 0, row = 0; string udp = "UDP"; string address = "255.255.255.255"; string buffer = ""; string itemstr = ""; //buffer = "MAC=" + lsvseardev.Items[i].SubItems[0].Text + "," + "IPAddress=" + txtnewip.Text + "," + "ComPwd=" + txtdevpwd.Text; buffer = "MAC=255.255.255.0,IPAddress=" + address;// + "ComPwd=136166"; MessageBox.Show("ModifyIPAddress operation begin!"); //return; ret = ModifyIPAddress(udp, address, buffer); //call ModifyIPAddress function if (ret >= 0) { //this.lsvseardev.Items[row].SubItems[1].Text = this.txtdevpwd.Text; MessageBox.Show("ModifyIPAddress operation succeed!"); return; } else { MessageBox.Show("ModifyIPAddress operation failed!" + ret); return; } Disconnect_pull(); }
<DllImport("plcommpro.dll", EntryPoint:="ModifyIPAddress")> Public Shared Function ModifyIPAddress(commtype As String, address As String, buffer As String) As Integer End Function Private Sub ModifIP() Connect_Pull() Dim ret As Integer = 0, row As Integer = 0 Dim udp As String = "UDP" Dim address As String = "255.255.255.255" Dim buffer As String = "" Dim itemstr As String = "" 'buffer = "MAC=" + lsvseardev.Items[i].SubItems[0].Text + "," + "IPAddress=" + txtnewip.Text + "," + "ComPwd=" + txtdevpwd.Text; buffer = Convert.ToString("MAC=255.255.255.0,IPAddress=") & address ' + "ComPwd=136166"; MessageBox.Show("ModifyIPAddress operation begin!") 'return; ret = ModifyIPAddress(udp, address, buffer) 'call ModifyIPAddress function If ret >= 0 Then 'this.lsvseardev.Items[row].SubItems[1].Text = this.txtdevpwd.Text; MessageBox.Show("ModifyIPAddress operation succeed!") Return Else MessageBox.Show("ModifyIPAddress operation failed!" + ret) Return End If Disconnect_pull() End Sub