Reputation: 1223
Basically, I'd like to know how can I change my server.js code in order for it to work with IPv6? I read somewhere that you only need to add your IPv6 address right next to the line where it says "listen(80)" which would make it look something like this "listen (80, "IPv6");"
In my code, however, it's a little bit more complicated than that.
Here are the lines of code related to the server:
const
server = http.createServer(options, app),
.
.
.
var ss=tls.createServer(options, function (box) {
box.setEncoding('utf8');
.
.
ss.listen(8010);
.
.
var sockets = require('socket.io').listen(server).of('/el');
.
.
.
if (!module.parent) {
server.listen(port, function () {
console.log('Listening', this.address());
})
}
Upvotes: 3
Views: 15432
Reputation: 849
This works here:
http = require('http')
server = http.createServer()
server.listen(8080, '::', function() {
console.log('listener');
});
Then testing it:
$ telnet ::1 8080
Trying ::1...
Connected to ::1.
Escape character is '^]'.
Upvotes: 5