I have setup two PC in the local network. One is Linux PC where i am running a Script, sending Heart beat message every 1s over UDP as IPv6 multicast message (FF02::1). In the other windows PC, I am running the below node.js code to receive the Heart beat message. I can see the messages in the Wireshark log, but i cant read the message from my code.
var HOST = '::';
var port = 50010;
var dgram = require('dgram');
var message = new Buffer('(data)');
var client = dgram.createSocket('udp6');
// client.bind(port,HOST);
// client.setMulticastLoopback(true);nod3
client.on("error",function(err){
console.log("server error:\n"+err.stack);
})
client.on("message",function(msg,rinfo){
console.log("Received Message:",msg+"from"+rinfo.address+":"+rinfo.port);
console.log("Node address:"+ rinfo.address);
console.log("Node port:"+rinfo.port);
})
client.bind('50010', '::', () => {
client.addMembership('ff02::1', '::%17');
});
client.on("listening",function(){
var address = client.address();
console.log("server listioning"+":"+address.address+":"+address.port)
});