更新 master.js

This commit is contained in:
钟进 2019-01-16 05:53:17 +00:00
parent 859ff58733
commit 68ffad6f69

View File

@ -485,18 +485,11 @@ function Master(options, adapter) {
if (options.config.type === 'tcp') { if (options.config.type === 'tcp') {
options.config.tcp.bind = "127.0.0.1" ;
const tcp = options.config.tcp;
if (!tcp || !tcp.bind || tcp.bind === '0.0.0.0') {
adapter.log.error('IP address is not defined');
return;
}
try { try {
modbusClient = Modbus('client', 'tcp')({ modbusClient = Modbus('client', 'tcp')({
options: { options: {
tcp: { tcp: {
host: tcp.bind, host: tcp.bind || "127.0.0.1",
port: parseInt(tcp.port, 10) || 502, port: parseInt(tcp.port, 10) || 502,
autoReconnect: false, autoReconnect: false,
}, },