When using UDP, is it realistic to send a message and expect it to be received?
Or is it more likely that multiple copies must be sent? Thus, requiring an acknowledge in the code?
When using UDP, is it realistic to send a message and expect it to be received?
Or is it more likely that multiple copies must be sent? Thus, requiring an acknowledge in the code?
In a local area network, it probably will be received with no issue. On a wide area network (like the Internet), there is no guaranty.
If you require an acknowledgement, why not use TCP to begin with?
I ran simple test code over my local WiFi network, can't remember exactly but maybe 0.1% failure rate, by which I mean lost, duplicated or errorred packets.
That’s what I thought. However, someone else stated that my code was wrong because it only sent a message once.
I have 6-10 devices and any one must be able to talk to any other. The message is 1 to 3 characters. UDP seemed to be the best choice.
The code runs on a MEGA2560 with an Arduino Ethernet Shield, hardwired together with a crossover cable, but will run through a switch.
However, someone else stated that my code was wrong because it only sent a message once
You have to decide if errors or lost packets are acceptable and write code accordingly. Sometimes I make it so the same data has to be received twice or 3 times before it's accepted as valid.
UDP is dead simple to use, but you pay for that simplicity with errors.
Dead simple... but I can’t get two characters from one machine to the next.
I expect that the problem lay not with UDP, but the Arduino Ethernet libraries and how I’m using them.
There is a lot more information in this post!
https://forum.arduino.cc/index.php?topic=681940.msg4587512#msg4587512