I never get an exception when using an UnitIdentifier that does not exists...
In short.. IP = OK.... PORT = OK...
For x = 1 To CInt(Trim(args(3)))
Try
Dim modbusClient As New EasyModbus.ModbusClient(Trim(args(1)), Trim(args(2))) With {
.UnitIdentifier = CByte(x),
.ConnectionTimeout = 5000
}
modbusClient.Connect()
If modbusClient.Connected Then
...
End If
modbusClient.Disconnect()
Catch ex As Exception
Console.WriteLine("ERROR = " & ex.Message)
End Try
Next
System.Threading.Thread.Sleep(10000)
I never get an exception when using an UnitIdentifier that does not exists...
In short.. IP = OK.... PORT = OK...
For x = 1 To CInt(Trim(args(3))) Try Dim modbusClient As New EasyModbus.ModbusClient(Trim(args(1)), Trim(args(2))) With { .UnitIdentifier = CByte(x), .ConnectionTimeout = 5000 } modbusClient.Connect() If modbusClient.Connected Then ... End If modbusClient.Disconnect() Catch ex As Exception Console.WriteLine("ERROR = " & ex.Message) End Try Next System.Threading.Thread.Sleep(10000)