I start my application which receives UDP data from an external application. Start the external app - is starts with a dynamically assigned port number of (say) 1234 and broadcasts a UDP message. The UDP socket in my app changes the remoteport to 1234 and away we go. My UDP reply messages go to remoteport 1234.

Stop and restart the external application. This time the dynamically assigned port is 5678.

The UDP socket in my app detects the change in remoteport, and changes remoteport setting to 5678. Unfortunately, my UDP reply messages still go to 1234.

What do I need to do to convince my socket to sent the UDP reply messages to the current remoteport number. So far the only thing that works is to restart my application. There's gotta be a better way.

TIA Bob.