What is UDP ?
The User Datagram Protocol(UDP) is one of the core protocols of the internet protocol suite.
Using UDP, Programs on networked computers can send short massages known as datagrams to one another.
What is TCP ?
Abbreviation of Transmission Control Protocol it also represent as TCP/IP where TCP is the main protocol. IP(internet protocol) deal with packets, TCP enables twp host to establish a connection and exchange streams of data.
Difference between TCP & UDP
The primary difference between TCP & UDP lies in the way they implement data transfer TCP include support guaranteed delivery, in which recipient automatically acknowledges the sender when message is received. In addition the sender waits and retransmits the data if implement guaranteed message delivery. A UDP datagram can get lost during transmission and the protocol will not be able to detect and report this.
Why TCP is more reliable ?
Few mechanisms help to provide the reliability of TCP such as
- Checksum—All TCP segment carry a checksum, which is used by the receiver to detect errors with either the TCP header or data.
- Duplicate and detection—It is possible for packets to be duplicated in packet switched network; therefore TCP keeps track of bytes received in order to discard duplicate copies of data that has already been received.
- Retransmissions—In order to guarantee delivery of data, TCP must implement retransmission schemes for data that may be lost or damaged. The use of positive acknowledgments by the receiver to the sender confirms successful reception of data. The lack of positive acknowledgments, coupled with a timeout period calls for retransmission.
- Sequencing –In packet switched networks, it is possible for packets to be delivered out of order. It is TCP’s job to properly sequence segments it receives so it can deliver the byte stream data to an application in order.
- Timers—TCP maintain various static and dynamic timers on data sent. The sending TCP waits for the receiver to reply with an acknowledgment within a bounded length of time. If the timer expires before receiving an acknowledgment, the sender can retransmit the segment.