I have recently upgraded my node.js version from 0.10.31 to 4.0.0 by installing n
via npm and then called n stable
.
With the new node version, my existing code broke.
This code:
var d = require("dgram");
var s = d.createSocket("udp4");
s.bind(9000);
var s6 = d.createSocket("udp6");
s6.bind(9000);
produces the following error:
events.js:141
throw er; // Unhandled 'error' event
^
Error: bind EADDRINUSE ::0:9000
at Object.exports._errnoException (util.js:837:11)
at exports._exceptionWithHostPort (util.js:860:20)
at dgram.js:213:18
at doNTCallback3 (node.js:440:9)
at process._tickCallback (node.js:346:17)
at Function.Module.runMain (module.js:477:11)
at startup (node.js:117:18)
at node.js:951:3
as soon as the IPv6 UDP socket wants to bind to port 9000.
There is no old node process running, and also there is no program already listening on port 9000.
If I change the second bind command to s6.bind(9001);
the error won't occur. If I change the order (udp6 binds first, udp4 second), then the error will show up when the udp4 socket tries to bind.
Could it be that the new node version tries to use the old core modules or something like that?
Can anyone explain this weird behaviour?
Thank you in advance for any help!
Regards