First, thanks for this code.
I found that there is an issue at the very end of it. you need to correct:
udp.beginPacket(remoteIp, port); // remote IP and port
to
udp.beginPacket(remoteIp, udp.remotePort()); // remote IP and port
otherwise connection is not established with the remote party
(the need of the temp variable remoteIP is questionable since you can access it via udp.remoteIP())
First, thanks for this code.
I found that there is an issue at the very end of it. you need to correct:
udp.beginPacket(remoteIp, port); // remote IP and portto
udp.beginPacket(remoteIp, udp.remotePort()); // remote IP and portotherwise connection is not established with the remote party
(the need of the temp variable
remoteIPis questionable since you can access it viaudp.remoteIP())