I ran into this a while ago and a discussion I recently had reminded me that I don't know how to solve it...
Suppose that you have a server and client communicating through UDP.
Your client listens on a UDP port X and receives the server packets.
Then a 3rd party process is started and it is also listening on the UDP port X.
Now it might read the packets meant to be received by my client and remove them from the queue and my client won't receive them at all.
Or even worse, if the clients send UDP messages to the server so it will assign them TCP ports to connect to. The server still has to connect to a constant UDP port X which the clients know, even if it's in use or else nobody will be able to connect to it.
How can I prevent it?