Thomas Mann
Thomas Mann

Reputation: 95

Modbus: The operation is not allowed on non-connected sockets

i am using to talk to a temperatur-sensor using modbus from: http://www.icpdas.com/products/PAC/i-8000/modbus.htm

Everything works fine but sometimes the ReadInputRegister creates an exception that says: „The operation is not allowed on non-connected sockets.“

Question: Is it possible that the module itself automatically closes a open session if is not used for a while?

Currently in my program i run an initialize at begin and save the handle in variable that i use if want to read or write via modbus.

Is it perhaps better to execute "init, read, close" always if i want to use it? So that i always creates a new handle?

Thx

Upvotes: 0

Views: 820

Answers (1)

Kevin Herron
Kevin Herron

Reputation: 6985

Almost all Modbus devices I've encountered will close an idle connection after 10-15 seconds, which is likely what's happening in this case.

Upvotes: 1

Related Questions