I keep getting an error when I try to start my script. If I remove the line calling "check();" then it works fine.
The error: node: ../src/node_io_watcher.cc:160: static v8::Handle node::IOWatcher::Set(const v8::Arguments&): Assertion `!io->watcher_.active' failed.
I am using version 6 I believe.
The code that is failing is below
function check(){
hosts.forEach(function(item) {
var sock = new net.Socket();
sock.setTimeout(7500);
ports.forEach(function(item1) {
sock.on('connect', function() {
console.log(item[0]+':'+item1[1]+' is up.');
sock.destroy();
serverstatus[item[1]][item1[0]] = "online";
}).on('error', function(e) {
console.log(item[0]+':'+item1[1]+' is down: ' + e.message);
serverstatus[item[1]][item1[0]] = "offline";
}).on('timeout', function(e) {
console.log(item[0]+':'+item1[1]+' is down: timeout');
serverstatus[item[1]][item1[0]] = "timeout";
}).connect(item1[1], item[0]);
});
});
}