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)

Thanks.

-- 
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/652c807a-76ec-4fa2-960a-71d2e8ad2891%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to