Thanks. I am using a BeagleBone Black running Debian to send UDP commands and listen for responses. I pasted your flow onto the Linux beaglebone 4.4.9-ti-r25 (Debian) host, and set the destination IP to raspberrypi, which I'm using to simulate the embedded device. I placed a loopback on the raspberry pi, consisting of a UDP in node listening on port 4002 and a UDP out node. Additionally, I ran tcpdump on both devices.
According to
beaglebone # tcpdump the Raspian loopback worked, and a response was sent to the BeagleBone:
18:59:10.430530 IP beaglebone.4002 > raspberrypi.4002: UDP, length 13
18:59:10.462154 IP raspberrypi.35245 > beaglebone.4002: UDP, length 13
However, the beaglebone debug tab did not report any messages received on the beaglebone UDP in node that was listening on port 4002.
The node-RED console output looked normal:
12 Sep 18:58:54 - [info] [udp in:e54eb2a3.737b88] udp listener at 0.0.0.0:4002Consequently, I placed a loopback on the beaglebone listening on port 4003, and injected a message from the raspberrypi, where I also added a UDP in node listening on port 4003. The symptoms matched the beaglebone:
raspberrypi # tcpdump reported that the beaglebone echoed port 4003 data, but the debug node on the Raspberry Pi did not display any echo. The Raspberry Pi is also running Node-RED 0.14.6.
The flows I used on each device are pasted below.
Flows on Beaglebone Black:[{"id":"e54eb2a3.737b88","type":"udp in","z":"41d11bb.178bb64","name":"","iface":"","port":"4002","multicast":"false","group":"","datatype":"buffer","x":240,"y":660,"wires":[["4565d804.ff7d"]]},{"id":"787d48e0.5cb0f8","type":"udp out","z":"41d11bb.178bb64","name":"","addr":"raspberrypi","iface":"","port":"4002","ipv":"udp4","outport":"4002","base64":false,"multicast":"false","x":460,"y":600,"wires":[]},{"id":"4565d804.ff7d","type":"debug","z":"41d11bb.178bb64","name":"","active":true,"console":"false","complete":"true","x":410,"y":660,"wires":[]},{"id":"5e74722b.64b2bc","type":"inject","z":"41d11bb.178bb64","name":"","topic":"test","payload":"test","payloadType":"date","repeat":"","crontab":"","once":false,"x":230,"y":600,"wires":[["787d48e0.5cb0f8","1f6d509b.7f126f"]]},{"id":"1f6d509b.7f126f","type":"debug","z":"41d11bb.178bb64","name":"","active":true,"console":"false","complete":"false","x":430,"y":560,"wires":[]},{"id":"6da129df.63645","type":"udp out","z":"41d11bb.178bb64","name":"","addr":"","iface":"","port":"","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":870,"y":600,"wires":[]},{"id":"2ebbe3d.e7b901c","type":"udp in","z":"41d11bb.178bb64","name":"","iface":"","port":"4003","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":710,"y":600,"wires":[["6da129df.63645","a6b694fd.dc29a"]]},{"id":"a6b694fd.dc29a","type":"debug","z":"41d11bb.178bb64","name":"","active":true,"console":"false","complete":"false","x":890,"y":660,"wires":[]},{"id":"421cd676.da4548","type":"comment","z":"41d11bb.178bb64","name":"Echo on beaglebone is working","info":"","x":770,"y":560,"wires":[]},{"id":"21609331.54d55c","type":"comment","z":"41d11bb.178bb64","name":"beaglebone does not receive Raspian loopback","info":"","x":370,"y":520,"wires":[]}]
Flows on Raspberry Pi:[{"id":"341c17d6.8683","type":"udp out","z":"18c489a.fe73b76","name":"","addr":"","iface":"","port":"","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":690,"y":700,"wires":[]},{"id":"e7749ea.22c216","type":"udp in","z":"18c489a.fe73b76","name":"","iface":"","port":"4002","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":540,"y":700,"wires":[["341c17d6.8683","e2ba3f53.e9ba68"]]},{"id":"e2ba3f53.e9ba68","type":"debug","z":"18c489a.fe73b76","name":"","active":true,"console":"false","complete":"true","x":690,"y":740,"wires":[]},{"id":"e2a78352.aaf678","type":"comment","z":"18c489a.fe73b76","name":"Echo on Raspian is working","info":"","x":600,"y":660,"wires":[]},{"id":"827402aa.01dc4","type":"udp out","z":"18c489a.fe73b76","name":"","addr":"beaglebone","iface":"","port":"4003","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":340,"y":700,"wires":[]},{"id":"2acf8e9f.e61092","type":"inject","z":"18c489a.fe73b76","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":700,"wires":[["827402aa.01dc4","9f2a9fe7.de85a"]]},{"id":"9f2a9fe7.de85a","type":"debug","z":"18c489a.fe73b76","name":"","active":true,"console":"false","complete":"false","x":310,"y":740,"wires":[]},{"id":"62f0ebff.998d2c","type":"comment","z":"18c489a.fe73b76","name":"Raspian does not receive Beaglebone loopback","info":"","x":240,"y":660,"wires":[]},{"id":"ba5b4c76.248d68","type":"udp in","z":"18c489a.fe73b76","name":"","iface":"","port":"4003","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":120,"y":800,"wires":[["5712b788.79acb"]]},{"id":"5712b788.79acb","type":"debug","z":"18c489a.fe73b76","name":"","active":true,"console":"false","complete":"false","x":300,"y":800,"wires":[]}]
At some point while editing the flows I accidentally had more than one udp node using port 4002 on the Raspian device. This seems to have broken the echo, but after deleting the redundant UDP nodes I got it to work again. I also rebooted Raspian during the troubleshooting, but I don't know whether that was necessary to get it to work again.
TL;DR: both devices can loop back using UDP in and UDP out, but neither reports received UDP in packets if the UDP in port is the same as the port that was bound by the UDP out node.
So why does it work for you, and not for me, neither on Debian nor on Raspian? What OS are you using?