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

In a big for() loop, never sending data #28

Open
hgshoggins opened this issue Apr 20, 2022 · 0 comments
Open

In a big for() loop, never sending data #28

hgshoggins opened this issue Apr 20, 2022 · 0 comments

Comments

@hgshoggins
Copy link

I'm calling artnet.set() in a big (and nested in another for()) loop, and I can't see data output to the network (I'm using tcpdump to check), however a simple call effectively transmits data. I know we're not here to debug my own code, but could this be an sync/async issue, having the set() method being called when we're already outside the loop?
It looks to me that ArtNet is rather sequential and that async calls are not very suitable, so I'm simply wondering if using NodeJS for this is relevant, and if I should simply try to stick to a more primitive and sequential language.

Anyway, trying to figure out the logic behind some simple code like this without being able to output data to an ArtNet node:

for(let i = 0; i <= maxval1; i++) {
        // computing some numbers
        for(let j = 0; j <= maxval2; j++){
                /* computing some other numbers
                   to make them available for outputting
                   in an array */
        }
        artnet.set(0, 1, data_array, function (err, res) {
                console.log("never reaching this point");
        });

}
artnet.close();

Should I ensure that something is correctly done before calling set()?

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