dgram: remote UDP server doesn't receive data

20 views
Skip to first unread message

Alexey Kushnaryov

unread,
Apr 1, 2020, 11:02:26 PM4/1/20
to nodejs
I'm sending data to remote server, but packages are not reach the destination. Wireshark shows that packages were sent. With receiving data no problems. I'm sure it's not a problem with network/firewall etc. Node.js v10.16.3, OS: macOS Catalina 10.15.2. Also tested with Node.js 12.16.1 and on Windows 10

const dgram = require("dgram");
const server = dgram.createSocket("udp4");
const message = Buffer.from("test");

server.on('error', function (error) {
   
console.log('Error: ' + error);
   
server.close();
});

server.on('close', function () {
   
console.log("closed");
});

server.on("listening", () => {
   
server.send(message, 0, message.length, destinationPort, destinationHost);
});

server.on('message', function (msg, info) {
   
console.log(msg.toString());
   
console.log(info);
});

server.bind(localPort);


Reply all
Reply to author
Forward
0 new messages