As we know .Net has UdpClient for simple Socket usage for UDP.
From MSDN:
If you are writing a relatively simple application and do not require maximum performance, consider using TcpClient, TcpListener, and UdpClient. These classes provide a simpler and more user-friendly interface to Socket communications.
I am wondering how much performance differences between Raw Socket and UdpClient? I know UdpClient is a wrapper of socket for Udp and it does not have asynchron read/write.
Anything else?
Thanks
As the docs say, UdpClient/TcpClient are a thin wrapper on top of Socket class. If all you want to do is send/receive blobs of data, then these classes are good. For this scenario, there is no difference in performance between Socket and UdpClient/TcpClient.
However, Socket does provide a faster way to do IO, in the form of XXXAsync() methods. These methods allow you to do very fast I/O, and are not exposed in TcpClient/UdpClient. That is what the docs mean by “perf difference” – it is that for faster perf, you will have to dig into Socket class and use these methods (XXXAsync).