Modbus4j the best way for do a polling
ramonhl last edited by
I am developing an Android application to read/write Modbus TCP variables in some PLC.
In this moment I read/write variables using the function ReadHoldingRegisters/WriteHoldingRegisters.
master.init()--> ReadHoldingRegisters or WriteHoldingRegisters --> master.destroy();
My question is:
If I want read the registers every second, What is the best way to do it? make 1 sec timer and read every second?
Can I use other modbus4j function to do this?
Thanks, best regards.
Modbus4J does not have any internal polling mechanisms, no. In Android it would probably be best to create a service that does the polling at the desired rate. If polling, as you say, once per second you should, of course, not be initializing and destroying each time.