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.
For more options, visit https://groups.google.com/d/optout.