I’m using a IoT device that report data using UDP protocol. According to it documentation, it require ACK that should be replied to it on the sending port.
Dev1 Send using IP1 PORTX
EDGE should reply to IP1 PORTX
I think that currently the communication is closed after data received. So we can’t preform a reply.
UDP is a connectionless protocol, so there’s no concept of disposing the connection for a reply. You should be able to use the UDP: Send Node to send data to the device. I would recommend double checking the device’s port. The port you see when receiving data may not be the same port the device is listening on.
This is a fairly good thread that explains it:
As for directly hosting a NodeJS application, the recommended approach is to put the application in another Docker container and run it alongside the Edge Agent.
I wrote a node js script that accept message from udp and after reading message it send a reply to the client using the client sender ip, and client sender port.
When I send a message on my nodejs app from my android phone, I got a reply from my node js server but using losant and this simple workflow, I see the message on losant debug, but the reply not comes from the losant udp sender.
I tested the losant udp sender separately to send message to an udp server, and it’s works.
I believe your issue is that the incoming address and port are not what you expect. Due to Docker networking, or other network factors, those may not reflect the actual address and port of the device that sent the message.
And here’s my workflow. You can see that the address and port that the device is actually listening on is very different than what the workflow received.
I had the same result. The IP addressed received by the edge agent is not the IP address of my Android phone. On the Android app, I did have to change the Read Timeout setting because by default it was set to not listen at all.
Can you paste a screenshot confirming that working.sourceAddress and working.sourcePort are the IP address and port that your Android phone is listening on?