I have an arduino on LAN emitting UDP packets with some data.
From my laptop using an ssh session with a Pi, both my laptop and Pi are also on the LAN, when I run:
sudo tcpdump -n udp port 8888
Terminal registers the UDP packets
18:14:44.868050 IP 192.168.1.27.8888 > 255.255.255.255.67: BOOTP/DHCP, unknown (0x1a), length 4
I'm a little unsure why it seems that the packet arrives at 255.255.255.255 on port 67 since my arduino is programmed to send to port 8888. The Pi is running the following script:
const dgram = require('dgram');
const catcher = dgram.createSocket('udp4');
catcher.on('listening', () => {
const address = catcher.address();
console.log(`server listening ${address.address}:${address.port}`);
});
catcher.on('message', (msg, rinfo) => {
console.log('Received a Message from: ' + rinfo.address + " Message Code: " + msg.readUInt8(0));
});
catcher.on('error', (err) => {
console.log(`server error:\n${err.stack}`);
});
catcher.bind({
address: "255.255.255.255",
port: 8888,
exclusive: true
});
Which is pretty much identical to the dgram basic documentation but I don't actually see anything show up in the terminal for the packets. I've tried cycling through binding to localhost, define it's local IP manually, when it's just left at catcher.bind(8888)
it's bound to 0.0.0.0, and lastly I've tried 255.255.255.255 but no luck. Even tried port 67 just be sure.
Obviously the packets are reaching the Pi as I can see them through tcpdump
but I'm unclear as to why they're not getting picked up.
Would any of you know? Cheers!