Skip to content

Commit

Permalink
Uses callback in listen() instead of a timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
baalexander committed Jun 20, 2012
1 parent aefd8cc commit 38cb922
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions example/portscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ var http = require('http')
var server = http.createServer(function (request, response) {

})
server.listen(3005, 'localhost')

// Waits briefly before port scanning to let the HTTP server start listening
setTimeout(function() {
server.listen(3005, 'localhost', function() {

// Checks the status of an individual port.
portscanner.checkPortStatus(3005, 'localhost', function(error, status) {
Expand All @@ -34,5 +31,5 @@ setTimeout(function() {
console.log('Found a closed port at ' + port)
})

}, 500)
})

0 comments on commit 38cb922

Please sign in to comment.