A number of characteristics can be used to describe communications protocols. The most important is the distinction between connection-oriented transport services (COTS) and connectionless transport services (CLTS).
TCP is an example of a connection-oriented protocol. It requires a logical connection to be established between the two processes before data is exchanged. The connection must be maintained during the entire time that communication is taking place, then released afterwards. The process is much like a telephone call, where a virtual circuit is established--the caller must know the person's telephone number and the phone must be answered--before the message can be delivered.
TCP/IP is also a connection-oriented transport with orderly release. With orderly release, any data remaining in the buffer is sent before the connection is terminated. The release is accomplished in a three-way handshake between client and server processes. The connection-oriented protocols in the OSI protocol suite, on the other hand, do not support orderly release. Applications perform any handshake necessary for ensuring orderly release.
Examples of services that use connection-oriented transport services are telnet, rlogin, and ftp.
Connectionless protocols, in contrast, allow data to be exchanged without setting up a link between processes. Each unit of data, with all the necessary information to route it to the intended destination, is transferred independent of other data packets and can travel over different paths to reach the final destination. Some data packets might be lost in transmission or might arrive out of sequence to other data packets.
UDP is a connectionless protocol. It is known as a datagram protocol because it is analogous to sending a letter where you don't acknowledge receipt.
Examples of applications that use connectionless transport services are broadcasting and tftp. Early implementations of NFS used UDP, whereas newer implementations prefer to use TCP.
The application developer must decide which type of protocol works best for the particular application. Some questions to ask are:
How reliable must the connection be?
Must the data arrive in the same order as it was sent?
Must the connection be able to handle duplicate data packets?
Must the connection have flow control?
Must the connection acknowledge the messages it receives?
What kind of service can the application live with?
What level of performance is required?
If reliability is paramount, then connection-oriented transport services (COTS) is the better choice.