Multiple Udp sockets @ WiFi shield?

I have a wifi shield and would like to have two udp sockets active at the same time.
Is that possible?

If not. Is it possible to let the same socket listen to two ports sequentially?

// do something

// do something else

This should work.

// in global variables
unsigned int localPortOne = 2390;
unsigned int localPortTwo = 2391;
WiFiUDP UdpOne;
WiFiUDP UdpTwo;

// in setup

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.

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.