-
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.
- Loading branch information
1 parent
e232efc
commit 3a78761
Showing
3 changed files
with
76 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Copyright (c) 2011 Brandon Ace Alexander | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
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,52 @@ | ||
|
||
## The What | ||
|
||
The portscanner module is a pure JavaScript port scanner for node.js. | ||
|
||
Portscanner can check a port, or range of ports, for 'open' or 'closed' | ||
statuses. | ||
|
||
## The How | ||
|
||
### To Install | ||
|
||
NPM package coming soon. Needs more testing and features first. For now, require | ||
the lib/portscanner.js file. | ||
|
||
### To Use | ||
|
||
A brief example: | ||
|
||
```javascript | ||
var portscanner = require('portscanner') | ||
|
||
// Checks the status of a single port | ||
portscanner.checkPortStatus(3000, 'localhost', function(error, status) { | ||
// Status is 'open' if currently in use or 'closed' if available | ||
console.log(status) | ||
}) | ||
|
||
// Find the first port in use or blocked. Asynchronously checks, so first port | ||
// to respond is returned. | ||
portscanner.findAnOpenPort(3000, 3010, 'localhost', function(error, port) { | ||
console.log('OPEN PORT AT ' + port) | ||
}) | ||
|
||
// Find the first available port. Asynchronously checks, so first port | ||
// determined as available is returned. | ||
portscanner.findAClosedPort(3000, 3010, 'localhost', function(error, port) { | ||
console.log('CLOSED PORT AT ' + port) | ||
}) | ||
``` | ||
|
||
Also check the example directory for more examples. | ||
|
||
### To Test | ||
|
||
Bleh. I am a fan of testing, but currently looking into an easier way to test | ||
HTTP connections. If any ideas, please message me. | ||
|
||
## The License (MIT) | ||
|
||
Released under the MIT license. See the LICENSE file for the complete wording. | ||
|
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