I understand that TCP/IP protocol is widely used as it is more secure (the third handshake). But, is there any other reason why TCP/IP is more popular than UDP?
This has nothing to do with security, TCP is a connection oriented protocol which means the communicating end points have to setup the communication channel (using a 3 way handshake) and has an acknowledgment mechanism to assure data transfer - also, lost segments will be retransmitted. Unlike UDP which is connection-less, meaning there is no communication channel established, the application just starts sending data and there is no mechanism to ensure data has been received successfully by the receiving endpoint (Unless some mechanism is implemented in the application layer) - it is mostly useful for real-time data (audio, video)
TCP Send data packets in order and you won't lose the data packets, even if you start using data, TCP rearranges the packet loss.and the packet will arrive the other end same order. it is connection based its like one endpoint to another endpoint.
UDP Using UDP is not reliable, sending packets independently, you might lose packets or data packets can arrive the end point, not in order.. this protocol is connectionless.
Handshake TCP=SYN, SYN-ACK, ACK ||| UDP=No handshake (connectionless protocol)
I'd say that the reason TCP is more commonly used than UDP is for several reasons:
- Streams are easier to use for most applications, no need to think of packet sizes
- Having the complexities of error- and loss- detection handled for the upper protocol is really convenient for the separation of layers
- But you have to suffer the potential for delays while that handling happens
On the other hand, in UDP the upper protocols have to handle the error cases, but with the freedom of connectionless communication. For some protocols, this gives great simplicity.
The statement that UDP is unreliable is not to be taken at face value.
- Under many circumstances you'll find UDP delivery is 100%
- TCP only gives you the reliability if it is available from the underlying transport, which all depends on bit error rates vs the segment sizes
- Timing is really hard with TCP
TCP/IP is widely used primarily because it is standardized vs competing networking protocol suites such as IPX/SPX and Appletalk. The World Wide Web, the web, is another reason TCP/IP is so popular.
HTTP is an application layer protocol designed within the framework of the Internet protocol suite. Its definition presumes an underlying and reliable transport layer protocol and Transmission Control Protocol (TCP) is commonly used.
Hypertext Transfer Protocol - Wikipedia
You have to put your terminology in the right perspectives. "TCP / IP protocol" is really a protocol stack and has "TCP /IP" and "UDP / IP" flavours. The most compelling reason for TCP / IP use is the pre-session connection set up which ensures communicating parties are aware of the engagement of one another in a communication session. Allied to this is the guarantee of deliveries via attempts to retransmit errored or lost packets and consequent error reports when connectivity fails. You lose communication speed with connection set ups and error handling because communication will not proceed until these are sorted out.
UDP / IP does things differently. Here message chunks are sent much like the postal system without contacting the far-end recipients. There are no prior agreements on session participation, and no error-handling, giving rise to higher speed of communication. However, there are no delivery guarantees. UDP / IP is historically labelled unreliable; however with more reliable communication networks, this unreliability tends to be less of a problem. This makes UDP / IP the toast of multimedia (video, voice) users who frown at network latency.
The TCP / IP protocol stack or suite of protocols is popular because it is the dominant communication model of the global Internet, with at least one billion hosts and another one billion websites. The protocol suite requires additional mechanisms to ensure security. TCP / IP is not much more popular than UDP / IP; infact I would imagine that the latter is more popular as multimedia application users are ever on the increase. In conclusion whichever flavour you use depends on your application.