I want to ping a server from my node.js app.
Is that doable?
Thanks
In Windows, hit Windows+R. In the Run window, type “cmd” into the search box, and then hit Enter. At the prompt, type “ping” along with the URL or IP address you want to ping, and then hit Enter.
open("GET", url, true); ping. send();
You could use exec
to call the system ping command
var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } exec("ping -c 3 localhost", puts);
node-net-ping is an awesome module that uses raw sockets.
And, if you are looking for only raw sockets, the same developer has a module for that too: node-raw-socket.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With