Skip to content Skip to sidebar Skip to footer

Modbus Protocol Escapes The Thread (android,jamod)

I'm trying to connect to PLC using ModBus protocol. I'm calling ModBus connect method from thread and I'm getting exception that I'm running communications on the main thread... I

Solution 1:

On button click, you call comm.run() which just executes the run() method directly in the context of the UI thread. This is a common error, you should never call run() directly on a Thread instance. Use comm.start() to execute the Modbus code in the context of your worker thread.

Here is the Javadoc

Post a Comment for "Modbus Protocol Escapes The Thread (android,jamod)"