tags:

views:

43

answers:

5

Can anyone tell be where to use the UDP protocol except live streaming of music/video? What are default usecases for UDP?

+2  A: 

Anything else where you need performance but can survive if a packet gets lost along the way. Multiplayer games come to mind, for example.

Joey
A: 

I use UDP to add chat capabilities to our applications. No need to create a server. It is also useful to dispatch events to all users of our applications.

Eduardo Mauro
and if message is lost? chat looks as a perfect case for tcp
Andrey
I've never seen a lost packet using UDP. Also, using UDP does not requires a known address. For instance, an application can listen to a certain port and in order to send a message to all users just broadcast it using UDP. We have been using this approach for many years without any problem. Mainly we use it in local networks.
Eduardo Mauro
A: 

A very common use case is DNS, since the overhead of creating a TCP connection would by far outweight the actual payload.

Additional use cases are NTP (network time service) and most video games.

ChrisM
A: 

UDP is stateless and is good for applications that have large numbers of clients connecting to a server such as time servers or DNS. The fact that no connection has to established and maintained reduces the memory required by the server. There is no handshaking involved and so this reduces the traffic on the network. On the downside, if the information transferred requires multiple packets there is no transmission control to ensure that all packets arrive and in the correct order - but in games packets lost are probably better than late or disordered.

Martin Thomas
+1  A: 

UDP is also good for broadcast, such as service discovery - finding that newly plugged in printer.

Also of note is that broadcast is anonymous, you don't need to specify target hosts, as such it can form the foundation of a convenient plug-and-play or high-availability network.

Steve-o