Created
August 2, 2012 19:21
-
-
Save cpsubrian/3239884 to your computer and use it in GitHub Desktop.
EADDRNOTAVAIL in simple node.js web server (OSX)
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
$ node http.js | |
events.js:48 | |
throw arguments[1]; // Unhandled 'error' event | |
^ | |
Error: connect EADDRNOTAVAIL | |
at errnoException (net.js:670:11) | |
at connect (net.js:548:19) | |
at Socket.connect (net.js:613:5) | |
at Object.<anonymous> (net.js:77:12) | |
at new ClientRequest (http.js:1091:25) | |
at Object.request (http.js:1427:10) | |
at Object.get (http.js:1432:21) | |
at Object._onTimeout (/private/tmp/test.js:9:20) | |
at Timer.ontimeout (timers.js:94:19) |
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
var http = require('http'); | |
http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.write('OK'); | |
res.end(); | |
}).listen(8083, function() { | |
var req = http.get('http://localhost:8083', function(res) { | |
res.on('data', function(chunk) { | |
console.log(chunk); | |
}); | |
res.on('end', function() { | |
console.log('end'); | |
}); | |
}); | |
req.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment