Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect Option? #77

Open
lbhopper opened this issue Mar 6, 2025 · 0 comments
Open

Disconnect Option? #77

lbhopper opened this issue Mar 6, 2025 · 0 comments

Comments

@lbhopper
Copy link

lbhopper commented Mar 6, 2025

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant