Your listening address is the equivalent of 0.0.0.0, which Windows does not like to connect to. The solution for your IPv6 case is the same as for IPv4, which is to give a host address. Unfortunately that means on Windows you can't do what you're trying to do with an ADDRANY listening socket.
~Ryan On Wed, Jul 29, 2015, 8:52 AM Greg Reimer <[email protected]> wrote: > Thanks. I think there are a few valid use cases for it, for example as > part of a testing function, which is what this was. > > On Wednesday, July 29, 2015 at 7:03:31 AM UTC-6, ryandesign wrote: >> >> >> 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/62f97d35-a04c-4bad-ad8e-417f6fce408b%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/62f97d35-a04c-4bad-ad8e-417f6fce408b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAGjmZGzPGLL7L8rK6aoKOVSXhQHq0H83G_fKpgQZv-72fv09gA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
