New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
127.0.0.1:0 causes exception #1596
Comments
What does it mean to connect to the port 0? 0 can be used to bind to a random available port but it does not make sense to use it to connect… |
Makes perfect sense in a test suite |
@stevenvachon would you mind explaining your use-case for connecting to port 0 in a test suite? This one appears to be a difference in behavior between Node.js and Io.js - node v0.10.32 returns a |
Oops, I'd misunderstood the question. Serving on port 0 is perfect for test suites, however connecting (as was said) to port 0 is stupid.
I'd ran that line of code to illustrate how this library is now inconsistent across node.js versions. Most errors are returned, while If anyone doesn't know, serving on port 0 is a standard way of connecting to any port that the OS has available, often a high number. Common ports such as 80 and 3000 are often not available and sniffing for such is faulty. var server = require("http").createServer();
server.listen(0, host, function() {
port = server.address().port;
}); |
Clarifying here as well: the issue is that this error is thrown, while all other errors are asynchronously passed to the callback function. |
Fixed in v2.72 #2164 |
The text was updated successfully, but these errors were encountered: