function getNextIP() { var network = networklist[netindex]; if(network.length == ipindex) { network = networklist[++netindex]; if(network == null) { dumpResults(); return null; } else ipindex = 0; } return(network[ipindex++]); } function scan { var currentip=getNextIP(); if(currentip != null) { var now=new Date(); var channel = new WebSocket("ws://"+currentip+":8000", 'wstest'); channel.onerror = function(evt) { var errTimestamp = evt.timeStamp; if(navigator.userAgent.search("Firefox")>0) errTimestamp = Math.floor(errTimestamp/1000); // Firefox macht das in Nanosekunden var timediff = errTimestamp - now; results[currentip] = timediff; scan(); }; channel.onopen = function() { results[currentip] = "up+websocket"; scan(); }; } }