| 1 | System testing for [modbus library](https://github.com/goburrow/modbus) |
| 2 | |
| 3 | Modbus simulator |
| 4 | ---------------- |
| 5 | * [Diagslave](http://www.modbusdriver.com/diagslave.html) |
| 6 | * [socat](http://www.dest-unreach.org/socat/) |
| 7 | |
| 8 | ```bash |
| 9 | # TCP |
| 10 | $ diagslave -m tcp -p 5020 |
| 11 | |
| 12 | # RTU/ASCII |
| 13 | $ socat -d -d pty,raw,echo=0 pty,raw,echo=0 |
| 14 | 2015/04/03 12:34:56 socat[2342] N PTY is /dev/pts/6 |
| 15 | 2015/04/03 12:34:56 socat[2342] N PTY is /dev/pts/7 |
| 16 | $ diagslave -m ascii /dev/pts/7 |
| 17 | |
| 18 | # Or |
| 19 | $ diagslave -m rtu /dev/pts/7 |
| 20 | |
| 21 | $ go test -v -run TCP |
| 22 | $ go test -v -run RTU |
| 23 | $ go test -v -run ASCII |
| 24 | ``` |