UDP.remoteport 'seems' to show wrong value

Setup: h/w Arduino Uno with ethernet shield s/w UDPSendReceiveString example as is, apart from IP address change, and local port set to 8022 instead of 8888. (this example receives a UDP packet then auto replies on the same port)

What happens: UDP data received ok on port 8022 but auto reply not appearing at sender. The line Serial.println(Udp.remotePort()); is displaying a high port number that oddly, increases by 1 each time another packet is received.

If I force the reply packet to use port 8022 (using Udp.beginPacket(Udp.remoteIP(), localport);) rather than this high number that the variable Udp.remotePort seems to contain, the reply is received back at the sender ok.

I should say that I know the calling UDP packet is on port 8022 as 1/ only that port triggers the response, and 2/ other software gets the 8022 call from the same source ok. In any case the sending port number is not increasing per packet.

There is probably an easy answer. I did read somewhere about another ethernet library for certain boards ?....but I can't find the reference now.


I don't have a problem, and have been testing UDP with a mega/ethernet shield for quite some time.

What hardware/software is on the "client" (other device) that is sending the packet and waiting for a response?


The 'test' client is an app wot-I-wrote in Vb.net, which works ok using 8022 between two pcs with that app. running at either end.

However, after your assertion re the example, I called in a 'second opinion' in the form of the nice free app 'Hercules' from HW-group and used that to generate the UDP client packet and what do you know, it works fine, in that port 8022 is reported in the sketch as 8022. Soooooo, my VB code is duff somewhere. I 'assumed' cos it worked end to end on 8022 that it was 8022. The destination port in the UDP header must be correct but not the source port. My app doesn't auto-reply, so the source port is not used.

Note to self - find a free IP packet monitor!

Many thanks