rossmann-engineering / EasyModbusTCP.NET

Modbus TCP, Modbus UDP and Modbus RTU client/server library for .NET implementations
922 stars 396 forks source link

No try catch error when using none existing UnitIdentifier #91

Open KeepITSimpleSolutions opened 1 year ago

KeepITSimpleSolutions commented 1 year ago

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)