code: function ping (host, callback) {
    var isWin = process.platform.indexOf('win') === 0; // win32 or win64
    var arg = isWin ? '-n' : '-c';
    var pong = spawn('ping', [arg, '3', host]); // only ping 3 times
  
    pong.on('error', function onerror (error) {
      callback(error, false);
      pong.kill();
    });
  
    pong.stdout.on('data', function stdoutdata (data) {
      callback(false, data.toString().split('\n')[0].substr(14));
      pong.kill();
    });
  
    pong.stderr.on('data', function stderrdata (data) {
      callback(new Error(data.toString().split('\n')[0].substr(14)), false);
      pong.kill();
    });
  }
docs: connection availablity