diff --git a/rtuclient.go b/rtuclient.go index ad6a31a..0b7b4e0 100644 --- a/rtuclient.go +++ b/rtuclient.go @@ -111,6 +111,9 @@ type rtuSerialTransporter struct { } func (mb *rtuSerialTransporter) Send(aduRequest []byte) (aduResponse []byte, err error) { + mb.mu.Lock() + defer mb.mu.Unlock() + // Make sure port is connected if err = mb.serialPort.connect(); err != nil { return