I have an instance of a class (lets call it A) which serves some threads, this instance only sends UDP packets via the UdpClient class. It initialize the the UdpClient in it
I think the best way here would be to create a new UdpClient
every time the method is called. This way, you can be sure the code is safe. The performance isn't likely to be a problem, and if profiling shows that it is, only then you should start solving that.
Also, you shouldn't forget to call EndSend()
after each BeginSend()
(ideally in the callback).
Eventually I believe that my current implementation should work with no issues (as long as Microsoft won't change the UdpClient class implementation).
For whom it might be interesting: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/cbdd9818-00f0-499f-a935-d8e555899d64