ST-node-ethernet-ip icon indicating copy to clipboard operation
ST-node-ethernet-ip copied to clipboard

PLC.disconnect() Does not Clear Timers

Open lbhopper opened this issue 1 year ago • 3 comments

Is there currently a disconnect option for this? I'm using process.exit() to exit out of my function instead of waiting for a timeout:

async function readPLC() {
    try {
        await PLC.connect('192.168.0.1, 0);

        const tagData = {};

        for (const tagName of tagArray) {
            const tag = new Tag(tagName);
            await PLC.readTag(tag);
            tagData[tagName] = tag.value;
        }

        console.log(JSON.stringify(tagData, null, 2));

        process.exit(0);
    } catch (err) {
        console.error(JSON.stringify({ error: err.message }, null, 2));
        process.exit(1);
    }
}

readPLC();

lbhopper avatar Mar 06 '25 21:03 lbhopper