Giter Club home page Giter Club logo

node-net-ping's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-net-ping's Issues

Windows 7, forbidden error

var pingSession = ping.createSession(); in my electron application failes with error

An attempt was made to access a socket in a way forbidden by its access permissions

at index.js:47:14

	this.wrap = new raw.SocketWrap (
			((options && options.protocol)
					? options.protocol
					: 0),
			((options && options.addressFamily)
					? options.addressFamily
					: AddressFamily.IPv4)
		);

OS Windows 7 x64

App threw an error during load

Hey,

I installed net-ping and now everytime I want to start the app I get this error:

    App threw an error during load
    Error: DLL-Initialising failed
    \\?\C:\PATH\node_modules\raw-socket\build\Release\raw.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\PATH\node_modules\raw-socket\index.js:4:11)
    at Object.<anonymous> (C:\PATH\node_modules\raw-socket\index.js:218:3)

the build\release folder contains raw.node

npm install error in OSX

I get this
CXX(target) Release/obj.target/raw/src/raw.o
../src/raw.cc:662:21: error: expected ';' after expression
String::Utf8String address (args[3]);
^
;
../src/raw.cc:662:11: error: no member named 'Utf8String' in 'v8::String'
String::Utf8String address (args[3]);

and many more errors.

gives error on a IP adress on windows local machine while does not give error when deployed to bitnami linux server

I am using net-ping for a small nodejs project to ping a list of IP adresses after regular interval, while testing locally on my windows machine it gives correct result , the dead IP address return error. But as i deployed the application to bitnami linux server net-ping stoped giving me error on the dead IP adresses.Although it gives error when i try to ping an incorrect ip address i.e 1.1.1.10000 etc.
here is the code i am using to ping :
function ping(user) {
var options = {
networkProtocol: netPing.NetworkProtocol.IPv4,
packetSize: 4,
retries: 0,
sessionId: (process.pid % 65535),
timeout: 1000,
ttl: 128
};
let session = netPing.createSession(options);
session.pingHost(user.ip, function (error, target) {
console.log(error+'----'+target);
// gives null on error even for dead IP address
if (error) {
......//
} else {
......///
}
}
});

Permit users to control the number of permitted hop timeouts for the `traceRoute()` method

The unexpected behavior is that the traceroute stops after it got three timeouts. I noticed that it is in the documentation, but I had forgot about it. Since many ISP:s block ICMP on some of their equipment, it is common for multiple hosts to not respond. The value of how many timeouts to allow can't be changed since it is hard coded. I want to be able to change that value.

How to ping more than once?

Hi, I'm not sure why its not pinging every time I call this. Even if I create session beforehand and re-use it.

// const session = ping.createSession({ timeout: 1000 });
setInterval(() => { 
    ping.createSession({ timeout: 1000 }).pingHost('8.8.8.8', (error, target) => {
        if (error)
            if (error instanceof ping.RequestTimedOutError)
                console.log('Cannot ping google...');
            else
                console.log(`Error pinging google: ${error.toString()}`);
        else
            console.log('Can ping google.');
    });
}, 2000);

Thanks!

TypeError: Cannot read property 'prototype' of undefined

Hello,
I tried using same as the documentation and it gets successfully compiled on terminal while it shows
TypeError: Cannot read property 'prototype' of undefined
on the browser side can you help me with the issue.
Thanks!

App crashing occasionally when try to ping hosts through net-ping.

Hi,

I'm getting this errors in logs and then app crashs.

node: ../deps/uv/src/unix/poll.c:88: uv_poll_stop: Assertion !(handle->flags & (UV_CLOSING | UV_CLOSED))' failed.`

This happens on Ubuntu server with running node v6.10.0 and net-ping v. 1.2.0

I've found that recently node-uptime project facing with such proplem:
https://groups.google.com/forum/#!topic/nodejs/obdxquewUcE

This usually happens when network has performance issues, such as packet lost and transmit/receive delays. In my app case this could happen 5-7 times for 24 hours.

My ping code looks like this:\

getPing = function(session, host, cbSuccess, cbError, reqTimeout){
  if(!session){
    var timeout   = (reqTimeout || 2)*1000;
    var session   = netPing.createSession({
      packetSize : 64,
      retries    : 2,
      timeout    : timeout 
    });
    session.on('error', function(error){
      logMsg(`ping error ${host} error: ` + error.toString());
      session.close ();
    });
  }
  session.pingHost(host, (error, target, sent, rcvd)=>{
    if(error) {
      cbError(error.toString());
    } else {
      var rtt = rcvd - sent;
      cbSuccess({status:'ok', result:'ok', data:rtt});
    }
    session.close();
  });
  return session;
}

Thanks, Roman.

No DestinationUnreachableError on centos 6 / redhat 6

I ping remote server from centos 7 server. If remote server is down, I get several RequestTimedOutError and then I get only. DestinationUnreachableError, what is absolutly fine for me. But when I try to ping same remote server from centos 6 server, I get only RequestTimedOutError. Is there any way to fix return error?

Can npm install

gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "net-ping2" "--save"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the raw-socket2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs raw-socket2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls raw-socket2
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\AkilaS\Desktop\WayneF-Projects\PingZinger\PingZinger\npm-debug.log

Windows Traceroute timeout.

Hello i have been trying the module in linux, os x and windows and it works great... but in windows the ping works, the traceroute works but it just give a timeout in each hop except in the last one.
Here is the output
capture

problem install

At installation displays in a broad gull here such error

123 verbose Windows_NT 10.0.15063
124 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "net-ping"
125 verbose node v8.9.1
126 verbose npm v5.5.1
127 error code ELIFECYCLE
128 error errno 1
129 error [email protected] install: node-gyp rebuild
129 error Exit status 1
130 error Failed at the [email protected] install script.
130 error This is probably not a problem with npm. There is likely additional logging output above.
131 verbose exit [ 1, true ]

Couldn't install the module.

i am using node verison 6.2.0 and my npm version 3.8.9 . And i am trying to install this module in centos 6.7. But i am getting the following error.

(node:11106) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

[email protected] install /root/services/fieldorder/node_modules/raw-socket
node-gyp rebuild

Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 545, in script_main
return main(sys.argv[1:])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 538, in main
return gyp_main(args)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 514, in gyp_main
options.duplicate_basename_check)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 130, in Load
params['parallel'], params['root_targets'])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2775, in Load
variables, includes, depth, check, True)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
includes, True, check)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 243, in LoadOneBuildFile
None)
File "binding.gyp", line 1
{
^
SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 2.6.32-573.12.1.el6.x86_64
gyp ERR! command "/usr/local/n/versions/node/6.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/services/fieldorder/node_modules/raw-socket
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 2.6.32-573.12.1.el6.x86_64
npm ERR! argv "/usr/local/n/versions/node/6.2.0/bin/node" "/usr/local/bin/npm" "install" "net-ping"
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs raw-socket
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/services/fieldorder/npm-debug.log

But i am able to install on my mac which is using the same verison of node and npm.

Timestamp reply instead of `sent`, `rcvd`

I've tested the times reported by your lib and they are pretty inaccurate. Unix ping uses Timestampt reply packet for response time calculation.
Would be awesome if you expose those times instead of sent and rcvd dates.

e.g

session.pingHost ('192.168.0.1', function (error, target, stat) {
    stat.sent       // Originate timestamp
    stat.receive  // Receive timestamp
    stat.transmit // Transmit timestamp
});

Keep up good work!

Support for Quality of Service

Hi, I was looking for a package like this one, but what I was searching specifically was QoS support, do you have any plans to add it?

Thanks.

Error: The specified procedure could not be found.

Hi Stephen,

Hope that you are fine. Luckily (or unluckily :)), I'm again the 1st to open an issue regarding net-ping.. this time on GitHub.

The BitBucket repo was removed, so, couldn't find the answer of a pre-replied question.

After installing net-ping, I get the error below while running the .js file:
C:\Users\u\test\node_modules\net-ping\node_modules\raw-socket\build\Release\raw.node

which I had asked the same question on BitBucket and remember that it was a path-related issue. However, couldn't find a solution this time and wanted to re-ask.

Thanks very much.

Failed at the [email protected] install script 'node-gyp rebuild'

@stephenwvickers
Looks like I am having an issue on Windows 10 installing net-ping. It's looking for the Windows SDK version 8.1, having Windows 10 this might be an issue. It looks to be targeting the Raw Socket. I attached the full error log.
net-pingErrLog.txt

Just in Case:
C:\Dev\PV\src\WebServer>npm install net-ping
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info ok
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info package.json [email protected] No license field.
npm info package.json [email protected] No license field.
npm info package.json [email protected] No license field.
npm info package.json [email protected] No license field.
npm info addNameTag [ 'net-ping', 'latest' ]
npm info attempt registry request try #1 at 3:08:32 PM
npm http request GET https://registry.npmjs.org/net-ping
npm http 200 https://registry.npmjs.org/net-ping
npm info retry fetch attempt 1 at 3:08:32 PM
npm info attempt registry request try #1 at 3:08:32 PM
npm http fetch GET https://registry.npmjs.org/net-ping/-/net-ping-1.2.0.tgz
npm http fetch 200 https://registry.npmjs.org/net-ping/-/net-ping-1.2.0.tgz
npm info install [email protected] into C:\Dev\PV\src\WebServer
npm info installOne [email protected]
npm info preinstall [email protected]
npm info attempt registry request try #1 at 3:08:33 PM
npm http request GET https://registry.npmjs.org/raw-socket
npm http 200 https://registry.npmjs.org/raw-socket
npm info retry fetch attempt 1 at 3:08:33 PM
npm info attempt registry request try #1 at 3:08:33 PM
npm http fetch GET https://registry.npmjs.org/raw-socket/-/raw-socket-1.4.0.tgz
npm http fetch 200 https://registry.npmjs.org/raw-socket/-/raw-socket-1.4.0.tgz
npm info install [email protected] into C:\Dev\PV\src\WebServer\node_modules\net-ping
npm info installOne [email protected]
npm info preinstall [email protected]
npm info attempt registry request try #1 at 3:08:33 PM
npm http request GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
npm info install [email protected] into C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket
npm info installOne [email protected]
npm info preinstall [email protected]
npm info build C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket\node_modules\nan
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket
npm info linkStuff [email protected]
npm info install [email protected]

[email protected] install C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket
node-gyp rebuild

C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\dylan.node-gyp\4.3.1\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\dylan.node-gyp\4.3.1',
gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error
MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK vers
ion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Dev\PV\src\W
ebServer\node_modules\net-ping\node_modules\raw-socket\build\raw.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Dev\PV\src\WebServer\node_modules\net-ping\node_modules\raw-socket
gyp ERR! node -v v4.3.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm info [email protected] Failed to exec install script
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "net-ping"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls raw-socket
npm ERR! There is likely additional logging output above.
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]

npm ERR! Please include the following file with any support request:
npm ERR! C:\Dev\PV\src\WebServer\npm-debug.log

Module not found: Can't resolve './build/Release/raw'

Hello,
I want to run the node-net-ping with reactjs and i make it with create-react-app v1.5.1.
The node-net-ping i install with npm and then i use the code below to make ping test :

var ping = require ("net-ping");
var session = ping.createSession ();

session.pingHost ("8.8.8.8", function (error, target) {
if (error)
console.log (target + ": " + error.toString ());
else
console.log (target + ": Alive");
});`

But the process end with error below :
./node_modules/raw-socket/index.js
Module not found: Can't resolve './build/Release/raw' in '/Users/me/Desktop/nodenetping/node_modules/raw-socket'

I'm using Nodejs v8.9.4 & npm v5.6.0 on macOS Sierra v10.12.6

npm install error!!!

./npm install net-ping
-|/-|/-|/-|/--|/-|/-|/--\

[email protected] install /home/node-v4.4.3-linux-x64/bin/node_modules/net-ping/node_modules/raw-socket
node-gyp rebuild

Traceback (most recent call last):
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 545, in script_main
return main(sys.argv[1:])
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 538, in main
return gyp_main(args)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 514, in gyp_main
options.duplicate_basename_check)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 130, in Load
params['parallel'], params['root_targets'])
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2775, in Load
variables, includes, depth, check, True)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
includes, True, check)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 243, in LoadOneBuildFile
None)
File "binding.gyp", line 1
{
^
SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 2.6.32-431.el6.x86_64
gyp ERR! command "/home/node-v4.4.3-linux-x64/bin/node" "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node-v4.4.3-linux-x64/bin/node_modules/net-ping/node_modules/raw-socket
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/home/node-v4.4.3-linux-x64/bin/node" "/home/node-v4.4.3-linux-x64/bin/npm" "install" "net-ping"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs raw-socket
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/node-v4.4.3-linux-x64/bin/npm-debug.log

On Windows got an error

I get this error on Windows 10

Error: An attempt was made to access a socket in a way forbidden by its access permissions

here was the code I was using

gulp.task('suman', [], function (cb) {

    //first ping server to make sure it's running, otherwise, continue

    var session = ping.createSession ();

    session.pingHost ('localhost:6969', function (error, target) {
        if (error){
            var server = require('./index').Server();
            server.on('listening', function () {
                session.close();
                cb();
            });
        }
        else{
            session.close();
        }
    });

});

Randomly fails with Promise all style where 10+ hosts are pinged at once and cannot ping 50+ at the same time

I am using Promise all because I want to ping ~400 hosts at a time.
It seems like trying to ping ~10 hosts (or more) randomly fails.
I have never been able to ping say even 50+ at the same time ever.
Does ping or raw socket have some concurrent ping limitations or settings?

C:>node --version
v8.9.3

Promise all and async-await (anything that tries to ping multiple in parallel) fails with high numbers of simultaneous pings:
https://github.com/ernestgwilsonii/javascript-ping-examples/tree/master/examples

session stop getting data when network error occurs.

Hi,
I've created such function with closure

getPing = function(host, cbSuccess, cbError, reqTimeout){
  var timeout   = (reqTimeout || 2)*1000;
  var session   = netPing.createSession({
    packetSize : 64,
    retries    : 2,
    timeout    : timeout
  });
  session.on('error', function(error){
    logMsg(`ping on error ${host} error: ` + error.toString());
    session.close ();
  });
  return ()=>{
    session.pingHost(host, (error, target, sent, rcvd)=>{
      if(error) {
        logMsg(`ping ${target} error: ` + error.toString());
        cbError(error.toString());
      } else {
        var rtt = rcvd - sent;
        cbSuccess({status:'ok', result:'ok', data:rtt});
      }
      session.close();
    });
  }
}

It works, but if I got in log: ping 10.3.4.21 error: RequestTimedOutError: Request timed out,
it will stop calling callbacks until I restart whole project.

Any suggestion how to correct this issue?

Thanks, Roman.

On "DestinationUnreachableError" trace-route request is being tried for "ttl" times, and retries option is ignored

when i try to send trace-route request to some unreachable Ip, i get below error as many as configured "ttl" times i.e. default is 30, so i get below trials 30 times, in-spite of the fact that retries option during createSession is configured for 3, so why not try 3 times and give up!?

"hopErrorCode": "DestinationUnreachableError: Destination unreachable (source=blahblah)"
"hopErrorCode": "DestinationUnreachableError: Destination unreachable (source=blahblah)".
"hopErrorCode": "DestinationUnreachableError: Destination unreachable (source=blahblah)".
..
..
"hopErrorCode": "DestinationUnreachableError: Destination unreachable (source=blahblah)".

Primarily why not giving same treatment to "DestinationUnreachableError" as you give to "RequestTimedOutError " ?

Not being able to ping a specific IP (although it can be pinged with the ping command)

Hi Stephen,

We are using net-ping very widely and it works great. Yet, to day, we have experienced an issue the 1st time.

Although we can ping the IP 177.54.146.154 from the computers, net-ping can't ping it from the same computers. Here is the test code:

var ping = require ("net-ping");

var pingOptions4 = {networkProtocol: ping.NetworkProtocol.IPv4, retries: 2,timeout: 5000, packetSize: 32};
var session = ping.createSession (pingOptions4);

session.on ("error", function (error) {
  console.log('error is:' + error);
});

session.pingHost ("177.54.146.154", function (error, target) {
    if (error) {
        console.log (target + ": Off");
    } else {
        console.log (target + ": Alive");
    }
});

Something causes the net-ping fail on this IP and couldn't debug what it can be. Any ideas?

Error NodeJS v5.5.0

I get this error with net-ping 1.1.12 and Node 5.5.0

module.js:440
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: Module version mismatch. Expected 47, got 14.
    at Error (native)
    at Object.Module._extensions..node (module.js:440:18)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/Dani/NodeJS-Tuts/snmp-agent/node_modules/net-ping/node_modules/raw-socket/index.js:4:11)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

An installation issue

I was just trying to install the module to an AWS instance and couldn't manage to install net-ping.

I have tried with different Nodejs, npm and net-ping versions but all failed similarly.

It always worked fine with AWS and couldn't find out why it failed this time.

Here is the full install log and will be glad to get your thoughts.

ubuntu@ip-161-45-32-241:~$ sudo npm install [email protected]
npm http GET https://registry.npmjs.org/net-ping/1.1.11
npm http 200 https://registry.npmjs.org/net-ping/1.1.11
npm http GET https://registry.npmjs.org/net-ping/-/net-ping-1.1.11.tgz
npm http 200 https://registry.npmjs.org/net-ping/-/net-ping-1.1.11.tgz
npm http GET https://registry.npmjs.org/raw-socket
npm http 304 https://registry.npmjs.org/raw-socket
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan

[email protected] install /home/ubuntu/node_modules/net-ping/node_modules/raw-socket
node-gyp rebuild

make: Entering directory /home/ubuntu/node_modules/net-ping/node_modules/raw-socket/build' CXX(target) Release/obj.target/raw/src/raw.o ../src/raw.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE raw::SocketWrap::Send(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/raw.cc:662:3: error: ‘Utf8String’ is not a member of ‘v8::String’ String::Utf8String address (args[3]); ^ ../src/raw.cc:662:22: error: expected ‘;’ before ‘address’ String::Utf8String address (args[3]); ^ ../src/raw.cc:663:44: error: ‘address’ was not declared in this scope struct sockaddr_in6 addr = uv_ip6_addr (*address, 0); ^ ../src/raw.cc:673:3: error: ‘Utf8String’ is not a member of ‘v8::String’ String::Utf8String address (info[3]); ^ ../src/raw.cc:673:22: error: expected ‘;’ before ‘address’ String::Utf8String address (info[3]); ^ ../src/raw.cc:674:43: error: ‘address’ was not declared in this scope struct sockaddr_in addr = uv_ip4_addr (*address, 0); ^ make: *** [Release/obj.target/raw/src/raw.o] Error 1 make: Leaving directory/home/ubuntu/node_modules/net-ping/node_modules/raw-socket/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.13.0-48-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/node_modules/net-ping/node_modules/raw-socket
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.13.0-48-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "[email protected]"
npm ERR! cwd /home/ubuntu
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.3.23
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ubuntu/npm-debug.log
npm ERR! not ok code 0

Error: Cannot find module 'footprint'

First time using node-net-ping, and failed.

Node.js version: v6.3.1

Error stack trace:

Error: Cannot find module 'footprint'                                                                                        
    at Function.Module._resolveFilename (module.js:440:15)                                                                   
    at Function.Module._load (module.js:388:25)                                                                              
    at Module.require (module.js:468:17)                                                                                     
    at require (internal/module.js:20:19)                                                                                    
    at Object.<anonymous> (D:\GitRepos\node-ping-vps\node_modules\node-ping\context.js:3:17)                                 
    at Module._compile (module.js:541:32)                                                                                    
    at Object.Module._extensions..js (module.js:550:10)                                                                      
    at Module.load (module.js:458:32)                                                                                        
    at tryModuleLoad (module.js:417:12)                                                                                      
    at Function.Module._load (module.js:409:3)   

All requests timeout during traceroute on Windows 10

C:\Users\alex\Code\Javascript\blizzard-network-debugger\src\api>node index.js
request: addressFamily=1 target=24.105.12.221 id=2 buffer=0800e5c5123800020000000000000000
Feed
Error { [RequestTimedOutError: Request timed out] name: 'RequestTimedOutError', message: 'Request timed out' }
request: addressFamily=1 target=24.105.12.221 id=3 buffer=0800e5c4123800030000000000000000
Feed
Error { [RequestTimedOutError: Request timed out] name: 'RequestTimedOutError', message: 'Request timed out' }
request: addressFamily=1 target=24.105.12.221 id=4 buffer=0800e5c3123800040000000000000000

This all happened before I stopped it. Below is the output from just a straight tracert command, with the same IP.

C:\Windows\system32>tracert 24.105.12.221

Tracing route to 24.105.12.221 over a maximum of 30 hops

  1     5 ms     3 ms     4 ms  192.168.0.1
  2    18 ms    17 ms    17 ms  96.120.60.29
  3    17 ms    27 ms    19 ms  ae-109-rur102.troutdale.or.bverton.comcast.net [162.151.213.157]
  4    28 ms    12 ms    18 ms  ae-52-ar01.troutdale.or.bverton.comcast.net [68.87.216.253]
  5    21 ms    32 ms    18 ms  be-33490-cr01.seattle.wa.ibone.comcast.net [68.86.92.217]
  6    25 ms    28 ms    22 ms  be-10846-pe01.seattle.wa.ibone.comcast.net [68.86.86.90]

I'm not sure what else to look for? The same code worked correctly on macOS, but I cannot get it to work on Windows.

The code:

var np = require('net-ping')
var sources = []

var session = np.createSession({
    retries: 5,
    _debug: true,
    timeout: 5000
})

session.traceRoute('24.105.12.221', options, feedCallback, doneCallback)

function doneCallback (error, target) {
    if (error) {
        console.log(target + ':', error.toString())
    } else {
        console.log('Trace Route Done')
        console.log('Sources', sources')
    }
}

function feedCallback (error, target, ttl, sent, rcvd) {
    if (error && error.source) {
        sources.push(error.source)
    }
}

Thoughts?

installation error

im running the package on windows and I got this Error when i press NPM Install
\node-net-ping-master\node_modules\raw-socket>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Inter-Tek\Desktop\node-net-ping-master\node_modules\raw-socket
gyp ERR! node -v v4.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs raw-socket
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Inter-Tek\Desktop\node-net-ping-master\npm-debug.log

Having a lot of issues on all machines

I have issues with this module on Mac, Windows and Linux

here is the Maven output from a Jenkins build today:

[INFO] Building smartconnect 0.0.2
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- exec-maven-plugin:1.2:exec (exec-check-deps) @ smartconnect ---
[INFO] 
[INFO] --- exec-maven-plugin:1.2:exec (exec-npm-install) @ smartconnect ---
npm WARN package.json [email protected] No license field.
npm WARN package.json Dependency 'debug' exists in both dependencies and devDependencies, using 'debug@^2.2.0' from dependencies
npm WARN package.json Dependency 'expect' exists in both dependencies and devDependencies, using 'expect@^1.13.0' from dependencies
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha@^2.3.4' from dependencies
npm WARN package.json Dependency 'nock' exists in both dependencies and devDependencies, using 'nock@^2.18.2' from dependencies
npm WARN package.json Dependency 'nodejs-dep-check' exists in both dependencies and devDependencies, using 'nodejs-dep-check@^1.2.2' from dependencies
npm WARN deprecated [email protected]: deprecated in favor of builtin child_process.execFile
npm WARN peerDependencies The peer dependency continuation-local-storage@~3 included from cls-bluebird will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated [email protected]: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})

> [email protected] install /home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js

npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN optional dep failed, continuing [email protected]

> [email protected] postinstall /home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/expect
> node ./npm-scripts/postinstall.js


> [email protected] install /home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/suman/node_modules/net-ping/node_modules/raw-socket
> node-gyp rebuild

Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 533, in script_main
    return main(sys.argv[1:])
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 526, in main
    return gyp_main(args)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 502, in gyp_main
    params, options.check, options.circular_check)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 129, in Load
    params['parallel'], params['root_targets'])
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2736, in Load
    variables, includes, depth, check, True)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 386, in LoadTargetBuildFile
    includes, True, check)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 238, in LoadOneBuildFile
    None)
  File "binding.gyp", line 1
    {
     ^
SyntaxError: invalid syntax
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 2.6.32-279.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/suman/node_modules/net-ping/node_modules/raw-socket
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 

> [email protected] install /home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/xml2json/node_modules/node-expat
> node-gyp rebuild

make: Entering directory `/home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/xml2json/node_modules/node-expat/build'
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
  AR(target) Release/obj.target/deps/libexpat/libexpat.a
  COPY Release/libexpat.a
  CXX(target) Release/obj.target/node_expat/node-expat.o
  SOLINK_MODULE(target) Release/obj.target/node_expat.node
  COPY Release/node_expat.node
make: Leaving directory `/home/jenkins/workspace/csv-smartconnect-x86_64-rel/nodejs/node_modules/xml2json/node_modules/node-expat/build'
npm ERR! Linux 2.6.32-279.el6.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

do you know about any such problem?

W7x64 VS2015 npm cannot find C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/V110/Microsoft.Cpp.Default.props

on Windows 7 x64 using [email protected] and [email protected] having Visual Studio 2015 Community Edition I ran into the error that npm cound not find C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/V110/Microsoft.Cpp.Default.props and hence couldn't build.

resolved this by setting the VC target path with
SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

Tried again npm install node-net-ping and this time it compiled and installed with some minor warnings, checked the example and that worked.

PS: This was my issue related to VS2015 and npm compiling.

Ping fails to detect subsequent timeouts after the first time

I'm seeing some interesting behavior that I can reproduce reliably, but not sure how to troubleshoot. If I have a script that pings a given host on an interval, once I break the network ACL (intentionally) to force a ping fail, the library does what I expect. And then when I fix the ACL to allow traffic again, the library again does what I expect and ping is successful.

However, once again I try to force a failure by breaking the ACL (disallowing all ICMP traffic to the target host), pings continue to be successful.

Any thoughts?

Here is the script I am running to reproduce:

Node runtime: 6.10
Mac OS X: 10.11.6
raw-socket: 1.5.1

'use strict';

const ping      = require('net-ping');
const session   = ping.createSession({ timeout: 1000 });

setInterval( () => {
  session.pingHost( 'some-public-ipv4', ( err, target ) => {
    if ( err ) {
      console.log('ping fail');
    } else {
      console.log('ping success');
    }
  })
}, 3000 );

I am using AWS security group configs to force the success/failure states (by blocking/allowing ICMP traffic)

Here's the script output (annotated for reference)

$ node test.js
ping fail
ping fail
ping fail
ping fail
ping fail
# fix ACL
ping success
ping success
ping success
ping success
ping success
# break ACL again 
ping success
ping success
ping success
ping success
ping success
ping success
ping success

getting some npm spewage for "raw-socket"

Looks like this lib depends on "raw-socket", according to npm ls / npm la command like so:

oleg@xps:~/WebstormProjects/oresoftware/suman$ npm la raw-socket
[email protected]
│ /home/oleg/WebstormProjects/oresoftware/suman
│ Suman is a next-generation Node.js test runner designed to supercede Mocha and rival AVA
│ git+https://github.com/ORESoftware/suman.git
│ https://github.com/ORESoftware/suman#readme
└─┬ [email protected]
  │ Ping and trace route to many hosts at once.
  │ git://github.com/stephenwvickers/node-net-ping.git
  │ https://github.com/stephenwvickers/node-net-ping#readme
  └── [email protected] 
      Raw sockets for Node.js.
      git://github.com/stephenwvickers/node-raw-socket.git
      https://github.com/stephenwvickers/node-raw-socket#readme

the problem I am having is that "raw-socket" has some node-gyp warnings:

> [email protected] install /home/oleg/WebstormProjects/oresoftware/curtain/node_modules/raw-socket
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
make: Entering directory '/home/oleg/WebstormProjects/oresoftware/curtain/node_modules/raw-socket/build'
  CXX(target) Release/obj.target/raw/src/raw.o
../src/raw.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE raw::CreateChecksum(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:70:43: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  uint32_t start_with = info[0]->ToUint32 ()->Value ();
                                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc:92:31: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   offset = info[2]->ToUint32 ()->Value ();
                               ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc:104:48: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   unsigned int new_length = info[3]->ToUint32 ()->Value ();
                                                ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE raw::Htonl(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:133:43: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  unsigned int number = info[0]->ToUint32 ()->Value ();
                                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE raw::Htons(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:152:43: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  unsigned int number = info[0]->ToUint32 ()->Value ();
                                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE raw::Ntohl(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:177:43: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  unsigned int number = info[0]->ToUint32 ()->Value ();
                                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE raw::Ntohs(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:196:43: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  unsigned int number = info[0]->ToUint32 ()->Value ();
                                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE raw::SocketWrap::GetOption(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:377:32: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  int level = info[0]->ToInt32 ()->Value ();
                                ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8442:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../src/raw.cc:378:33: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  int option = info[1]->ToInt32 ()->Value ();
                                 ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8442:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../src/raw.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE raw::SocketWrap::New(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:461:42: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   socket->protocol_ = info[0]->ToUint32 ()->Value ();
                                          ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc:469:27: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
    if (info[1]->ToUint32 ()->Value () == 2)
                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE raw::SocketWrap::Send(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:651:30: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  offset = info[1]->ToUint32 ()->Value ();
                              ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc:652:30: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  length = info[2]->ToUint32 ()->Value ();
                              ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
../src/raw.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE raw::SocketWrap::SetOption(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/raw.cc:715:32: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  int level = info[0]->ToInt32 ()->Value ();
                                ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8442:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../src/raw.cc:716:33: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  int option = info[1]->ToInt32 ()->Value ();
                                 ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8442:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../src/raw.cc:735:27: warning: ‘v8::Local<v8::Int32> v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   len = info[3]->ToInt32 ()->Value ();
                           ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8442:14: note: declared here
 Local<Int32> Value::ToInt32() const {
              ^
../src/raw.cc:747:29: warning: ‘v8::Local<v8::Uint32> v8::Value::ToUint32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   ival = info[2]->ToUint32 ()->Value ();
                             ^
In file included from /home/oleg/.node-gyp/7.2.1/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:
/home/oleg/.node-gyp/7.2.1/include/node/v8.h:8436:15: note: declared here
 Local<Uint32> Value::ToUint32() const {
               ^
  SOLINK_MODULE(target) Release/obj.target/raw.node
  COPY Release/raw.node
make: Leaving directory '/home/oleg/WebstormProjects/oresoftware/curtain/node_modules/raw-socket/build'

I think I should take it up with the "raw-socket" folks, but maybe you can verify that my observations described above are true? thanks

Allow the ability to ping a hostname

I chose this module to ping domain names that are being setup in DNS to detect when they come available but I'm not able to do so because I get an error stating "Invalid IP address".

Node compatible with node version 4.0

I was not able to install net-ping with node version 4.0

npm ERR! Linux 3.13.0-63-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "raw-socket"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls raw-socket
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

Error: connect ETIMEDOUT on local interface

While testing my new app on IPV4, on a local interface, I get the following error:
Error: connect ETIMEDOUT
at Connection._handleConnectTimeout (/home/evan/node_modules/mysql/lib/Connection.js:419:13)
at Object.onceWrapper (events.js:293:19)
at emitNone (events.js:86:13)
at Socket.emit (events.js:188:7)
at Socket._onTimeout (net.js:352:8)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
--------------------
at Protocol._enqueue (/home/evan/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Protocol.handshake (/home/evan/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at Connection.connect (/home/evan/node_modules/mysql/lib/Connection.js:130:18)
at connectToDatabase (/home/evan/Projects/Status/driver.js:26:11)
at Object. (/home/evan/Projects/Status/driver.js:21:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)

raw socket

Can you explain what is the rational behind using raw socket for node-net-ping?

Requiring root privilege on Linux is a pain for my use case but mostly I'm curious about the reason.

Thanks

When all pings completed ?

Great program Stepen, works perfectly for me. I would like to send output to the stream instead of console, and don't know when to stop sending to the stream. So my question is how do I know net-ping is finished (got all responses and timeouts)

Operation not permitted

Working with node, angular & election app, trying to use your module to ping some IP to check the device status.

var pingSession = require("net-ping").createSession();

getting the following Error @ line raw-socket/index.js: 47

Operation not permitted

Please suggest me how to resolve this.

Process Versions { http_parser: '2.7.0',
node: '6.5.0',
v8: '5.3.332.47',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
modules: '50',
openssl: '1.0.2h',
electron: '1.4.10',
chrome: '53.0.2785.143',
'atom-shell': '1.4.10' }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.