Some common applications written with UDP are: DNS (domain Name System), NFS (Network File system), and SNMP (Simple Network Management Protocol).
Instead of establishing a connection with the server, the client sends a datagram to the server using the SendTo function, which must specify the address of the destination (that is, the server) as an argument. Similarly, the server does not accept connections from customers, but instead calls the Recvfrom function, waiting for data from one customer to arrive. Recvfrom will return the client's protocol address with the received datagram, so the server can send the response to the correct customer.
For UDP, it is possible to write a data of length 0. In the case of UDP, this forms an IP datagram that contains only one IP header (typically 20 bytes for IPv4, typically 40 bytes for IPv6), and a 8-byte UDP header without data. This means that for datagram protocols, it is acceptable for recvfrom to return a value of 0: it does not represent a closed connection to the end as read on the TCP socket returns a value of 0. Since UDP is connectionless, there is no such thing as shutting down a UDP connection.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/