I recently updated from node 0.8.xx to 0.10.xx and found out that the following code will create an exception.
dgram.js:381 throw new errnoException(process._errno, 'addMembership'); ^ Error: addMembership EBADF
After some searching I found this issue, which shows that they changed bind(port,[addr]) to be asynchronous. The solution is to change
udpsock.bind(port);
udpsock.addMembership(mcastAddr);
to
udpsock.bind(port,null,function(){
udpsock.addMembership(mcastAddr);
});
I hope this helps someone else.