通过modbus-tcp控制开关,但是执行5次到六次的时候就会出现连接超时情况
Traceback (most recent call last):
File "text_switch.py", line 19, in <module>
Hold_value = master.execute(slave=12, function_code=md.READ_HOLDING_REGISTERS, starting_address=2106, quantity_of_x=1)[0]
File "/home/fuxi/.local/lib/python3.8/site-packages/modbus_tk/utils.py", line 39, in new
raise excpt
File "/home/fuxi/.local/lib/python3.8/site-packages/modbus_tk/utils.py", line 37, in new
ret = fcn(*args, **kwargs)
File "/home/fuxi/.local/lib/python3.8/site-packages/modbus_tk/modbus.py", line 298, in execute
response = self._recv(expected_length)
File "/home/fuxi/.local/lib/python3.8/site-packages/modbus_tk/modbus_tcp.py", line 216, in _recv
rcv_byte = self._sock.recv(1)
socket.timeout: timed out