made udp4 socket default bind to an ipv4 address

it seems that on windows, binding a udp4 socket to an ipv6 address (here is ::1) raises and EINVAL error
This commit is contained in:
Mostafa Samir 2016-04-01 21:28:39 +02:00
parent e9d34a8178
commit 36457fa5bd
1 changed files with 4 additions and 0 deletions

View File

@ -203,6 +203,10 @@ function serveNet(host,port,UDPType,callback){
if(UDPType){
this.server[UDPType]=true;
if(UDPType === "udp4" && host === "::1") {
// bind udp4 socket to an ipv4 address to avoid failing on windows
this.server.path = "127.0.0.1";
}
}
this.server.on(