There is a bit of functionality that I don't believe is included in the 
API, but would like to check. It is that it's possible to bind a process to 
both IPv4 and IPv6 at the same time. Take the following code:

var http = require('http');
http.createServer(function(req, res) {
        console.log(req.connection.remoteAddress);
        res.writeHead(200, {'Content-Type' : 'text/plain'});
        res.end('Hello World\n');
}).listen(8234, '127.0.0.1');


Now if I try to visit http://[::1]:8234/ the request will fail. Now take the 
following:


var http = require('http');
http.createServer(function(req, res) {
        console.log(req.connection.remoteAddress);
        res.writeHead(200, {'Content-Type' : 'text/plain'});
        res.end('Hello World\n');
}).listen(8234, '::1');


If I visit http://127.0.0.1:8234/ the request will also fail. But using this 
final example:


var http = require('http');
http.createServer(function(req, res) {
        console.log(req.connection.remoteAddress);
        res.writeHead(200, {'Content-Type' : 'text/plain'});
        res.end('Hello World\n');
}).listen(8234, '::');


I'm able to hit the process from both http://[::1]:8234/ and 
http://127.0.0.1:8234/.


I wasn't able to find this in the API, and am wondering if this is functioning 
how it's supposed to?

-- 
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

Reply via email to