On Jul 29, 2015, at 12:13 AM, Greg Reimer wrote:
> This works on OS X, but fails on Windows 7 (io.js 2.5.0):
>
> var http = require('http')
>
> var server = http.createServer(function(req, res) {
> res.end('hello')
> }).listen(0, function() {
>
> var addr = server.address()
>
> http.get({
> hostname: addr.address, // <-- this
> port: addr.port,
> path: '/foo',
> }, function(res) {
> console.log('hello')
> process.exit(0)
> })
> })
>
> If I change addr.address to 'localhost' it starts working, but I'm curious
> why. Here's the error:
>
> Error: connect EADDRNOTAVAIL :::51539
> at Object.exports._errnoException (util.js:812:11)
> at exports._exceptionWithHostPort (util.js:835:20)
> at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1048:14)
I don't know the answer to your question, but it looks like you're trying to
have your web server send an http request to itself. That's usually an
indication that you've structured your program incorrectly; it shouldn't ever
be necessary to do that.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/B9E2FF12-C14A-4445-85B7-E6054359ADCA%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.