diff --git a/server.js b/server.js index e3829ae..57704f1 100644 --- a/server.js +++ b/server.js @@ -121,9 +121,9 @@ Server.prototype.listen = function (/* port, hostname, onlistening */) { // ATTENTION: // binding to :: only receives IPv4 connections if the bindv6only // sysctl is set 0, which is the default on many operating systems. - if (self.http) self.http.listen(port.http || port, hostname || '::') - if (self.udp4) self.udp4.bind(port.udp || port, hostname) - if (self.udp6) self.udp6.bind(port.udp || port, hostname) + if (self.http) self.http.listen(port.http || port, (hostname && hostname.http) || hostname || '::') + if (self.udp4) self.udp4.bind(port.udp || port, (hostname && hostname.udp) || hostname) + if (self.udp6) self.udp6.bind(port.udp || port, (hostname && hostname.udp) || hostname) } Server.prototype.close = function (cb) {