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

View file

@ -203,6 +203,10 @@ function serveNet(host,port,UDPType,callback){
if(UDPType){ if(UDPType){
this.server[UDPType]=true; 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( this.server.on(