Skip to content

GatewayTargetDeviceFailedToRespond with Modbus TCP Client #82

@skykep

Description

@skykep

If I have my polling interval too fast, I get this error. The client/server (master/slave) are in very close proximity on an uncongested network.

    modbus.tcp.connect(502, "192.168.2.165", { debug: null, retries: 0, retry: 3000 }, (err, connection) => {
        // do something with connection
        setInterval(function () {
            connection.readHoldingRegisters({ address: (sqlResult[0].MBAddr - 40000), quantity: 2 * sqlResult.length, extra: { unitId: 1 } }, (err, res) => {
                if (err) {
                    console.log(Date.now() + ": " + err);
                }
                    for (i = 0; i < sqlResult.length; i++) {
                        convert_to_32(res.response.data[2 * i].readUIntBE(0, 2), res.response.data[2 * i + 1].readUIntBE(0, 2), 'ModbusData[' + i + ']');
                    }
            });
        }, 200);
    });

Very randomly, I get "Error: GatewayTargetDeviceFailedToRespond:"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions