AdvancedHMI Software

General Category => Support Questions => Topic started by: gfulk on August 11, 2017, 02:33:47 PM

Title: Check for connection
Post by: gfulk on August 11, 2017, 02:33:47 PM
Is there a way to check if a ModbusRTU connection is there or not?
I tried the IsSubscriptionActive() method, but it didn't behave how i thought it would.
Title: Re: Check for connection
Post by: Archie on August 12, 2017, 09:15:29 AM
ModbusRTU does not have a "connection" per se as doesn't something like an Ethernet socket. The only way to know if there is a connection is to perform a read and see if it fails.

Try
   ModbusRTUCom1.Read("40001")
   MsgBox ("Successful connection")
Catch ex as exception
   MsgBox ("Failed")
End Try