Skip to content

Instantly share code, notes, and snippets.

@frnkst
Last active June 19, 2018 11:29
Show Gist options
  • Save frnkst/528db7db52dddbfa41b14ba0235919b3 to your computer and use it in GitHub Desktop.
Save frnkst/528db7db52dddbfa41b14ba0235919b3 to your computer and use it in GitHub Desktop.
M2
function sendPacket() {
port++;
if (tries >= 3) {
tries = 0;
ttl++;
}
tries++;
udpSocket.setTTL(ttl);
startTime = process.hrtime();
udpSocket.send(new Buffer(''), 0, 0, port, DESTINATION_IP, function (err) {
if (err) throw err;
timeout = setTimeout(handleReply, MAX_TIMEOUT_IN_MILLISECONDS);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment