// in global variables
unsigned int localPortOne = 2390;
unsigned int localPortTwo = 2391;
WiFiUDP UdpOne;
WiFiUDP UdpTwo;
// in setup
UdpOne.begin(localPortOne);
UdpTwo.begin(localPortTwo);
Then refer to each as UdpOne and UdpTwo instead of just Udp in the function calls.
I have tried that set up, was my starting point.
In this configuration I was able to receive Udp messages, but not to send them.
I'll try it again later today or tomorrow and report back test results.
I had the same problem. The firmware or library does weird things when sending a udp packet in response to receiving one. It sends from a different port. It seems to use a different socket.
I found this problem using netcat.
edit: I would use something like this in setup.
Udp.begin(8000);
I compiled and uploaded the WiFiUdpSendReceiveString code. Then I sent a packet from another device to that port, but when I get the response, it shows the packet was not sent from port 8000, but something like port 4795.