You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool-biz/nmodbus/modbus_tcp_test.go

28 lines
529 B
Go

package nmodbus_test
import (
"encoding/binary"
"git.noahlan.cn/noahlan/nnet/config"
"git.noahlan.cn/noahlan/ntool-biz/nmodbus"
"testing"
)
func TestA(t *testing.T) {
ngin, handler := nmodbus.NewModbusTCPEngine(nmodbus.ModbusTCPConf{
EngineConf: config.EngineConf{
Mode: "dev",
Name: "ModbusTCP",
},
ByteOrder: binary.BigEndian,
})
defer ngin.Stop()
handler.DataManager(0x01).WriteSingleHoldingRegister(0, 3)
_ = ngin.ListenTCP(config.TCPServerConf{
Protocol: "tcp",
Addr: "0.0.0.0:5502",
})
}