arduino wifi shield modifying sourceport to 4097 on the answer packet

Hello everyone !

I've got an issue that I can't fix even after spending lot of time(it's driving me crazy), it's really a weird one, and it seems other people have this issue, I would love to find/get a solution to it. I updated the wifi shield firmware to 1.1.0 and tried different wifi shield but it didn't fix the issue, so it means the issue is in the library/my code. I think it's probably in the library since I don't make the udp header myself. I've used the tutorial from arduino website of Send and Receive UDP String and I adapted it to receive and send coap packets.

Obviously, ping is working (so the wifi connection is working, it's answering).

I've a computer sending a coap packet to the arduino with the wifi shield. When I send a packet (with sourceport 45000 and dest port 5863), the packet is received at the arduino. It's anwered but the answer, instead of having dest port 45000 and sourceport 5863, it has sourceport 4097, even if I modify the port 5863, it will always be port 4097. To explain it better, here is a wireshark screenshot: |500x337

I've even looked into Wifi and WifiUdp library but I can't find the line where the local port is "modified" to this weird 4097 port. This issue is haunting me. And When I tried with ethernet, I had no issue and it was working fine.

Thanks a lot for any help !

Good bye.

To explain it better, here is a wireshark screenshot

The code would have been even better.