node.js ping
var session = ping.createSession (); session.pingHost (target, function (error, target) { if (error) console.log (target + ": " + error.toString ()); else console.log (target + ": Alive"); });
Here is what the above code is Doing:
1. We’re importing the ping module.
2. We’re creating a session object.
3. We’re using the pingHost() method to ping the target.
4. We’re printing the result.