pkg/plc/modbusx/connection_manager.go
@@ -1,8 +1,10 @@ package modbusx import ( "apsClient/conf" "github.com/goburrow/modbus" "sync" "time" ) type ConnectionManager struct { @@ -59,5 +61,8 @@ } func newGetModbusConnection(ipAddr string) modbus.Client { return modbus.TCPClient(ipAddr) handler := modbus.NewTCPClientHandler(ipAddr) handler.Timeout = 10 * time.Second handler.SlaveId = byte(conf.Conf.PLC.SlaveId) return modbus.NewClient(handler) }