-3

I'm a beginner in C# .net

I did saw some tutorials for creating socket and send Read data and some tutorials creating "UDPClient" send and receive the data

Which one is better "Socket" or "UDPClient" and what is difference give any example.

Rajendar
  • 11
  • 2
  • 1
    Briefly, both are sockets, there's UDP vs TCP - UDP is non-verified but can do broadcasts, TCP is peer-to-peer, guaranteed delivery. – 500 - Internal Server Error Aug 03 '21 at 12:52
  • Both `Socket` and `UdpClient` will work for the purpose of conveying UDP. `UdpClient` wraps up some additional functionality, but: the examples are on MSDN under `Socket` and `UdpClient` – Marc Gravell Aug 03 '21 at 13:09
  • Does this answer your question? [What is the difference between a port and a socket?](https://stackoverflow.com/questions/152457/what-is-the-difference-between-a-port-and-a-socket) and [Difference between TCP and UDP sockets](https://stackoverflow.com/questions/36790595/difference-between-tcp-and-udp-sockets) and [Are there any functional difference in using Socket or UdpClient for multicasting?](https://stackoverflow.com/questions/34765417/are-there-any-functional-difference-in-using-socket-or-udpclient-for-multicastin) –  Aug 03 '21 at 13:22

1 Answers1

0

UDPClient is built on top of Socket and is designed to make it easier to construct UDP based applications. In general, it's typically easier to leverage UDPClient so you don't have to deal with the low level details as much.

RQDQ
  • 15,461
  • 2
  • 32
  • 59