On Sat, Feb 11, 2012 at 10:03, Lothar Pfeiler <[email protected]> wrote: > Hi, > > when I use > > server.listen(port) > > server.address() gives me a nice object with port, family and > hostname. > > But when I use > > server.listen(port, hostname) > > server.address() returns null. > > I guess, server.address() uses os libs so here are the platforms where > I tested it: > node v0.6.8 on Linux server 2.6.32-33-server #70-Ubuntu > node v0.6.7 on Mac OS X Lion > > Is this already a known bug or is it a feature?
It's a documentation bug. `server.address()` isn't reliable until the 'listening' event is emitted because Node may need to do a DNS lookup when you pass in a host name, the results of which aren't immediately available. I've updated the documentation in d3f6b09. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
