-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cannot specify the retries parameter for the Session class as 0, Upda…
…te version in package.json to 1.1.11, Update README.md for 1.1.11, Added example program ping-retries-0.js
- Loading branch information
1 parent
356fd0f
commit e0da26e
Showing
4 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
var ping = require ("../"); | ||
|
||
if (process.argv.length < 4) { | ||
console.log ("usage: node ping-retries-0 <target> <timeout>"); | ||
process.exit (-1); | ||
} | ||
|
||
var target = process.argv[2]; | ||
|
||
var options = { | ||
retries: 0, | ||
timeout: parseInt(process.argv[3]) | ||
}; | ||
|
||
var session = ping.createSession (options); | ||
|
||
session.on ("error", function (error) { | ||
console.trace (error.toString ()); | ||
}); | ||
|
||
session.pingHost (target, function (error, target) { | ||
if (error) | ||
if (error instanceof ping.RequestTimedOutError) | ||
console.log (target + ": Not alive"); | ||
else | ||
console.log (target + ": " + error.toString ()); | ||
else | ||
console.log (target + ": Alive"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters