Whenever a computer wants to communicate with another computer. The communication between those two computers need to be good and reliable. So, we can guarantee that the data is received correctly. For example when you want to view a web page or download a file or locate an email, you would expect to view the webpage intact and in order, with nothing missing.
Or if you are downloading a file you would want the entire file and not just a part of the file. Because if data is missing or out of order it wouldn’t be of any benefit to you. This is where TCP comes in.
TCP stands for Transmission Control Protocol and is one of the main protocols used in TCP/IP network. TCP is, what is used to guarantee that all the data is received and in order. Because without TCP some of the data could be missing or out of order.
If you view a web page without TCP your web page could be all messed up. The images could be missing all the text could be backward and out of order. Or if you download file then, you might not get the entire file or you could get the file out of order which would render the file useless.
TCP is a connection oriented protocol, which basically means that it must first acknowledge a session between the two computers that are communicating. So, the two computers verify a connection before any communication takes place. And it does this by using three way handshake.
- Computer send a message called a SYN.
- Then the receiving computer will send back the acknowledgement message, telling the sender that it has received the message and then finally the sender computer send another acknowledgement message back to the receiver.
Once this has taken place data can be delivered. The important thing about TCP is that it guarantee the delivery of data. If a data package goes astray and doesn’t arrive, then TCP will resend it.
UDP is very is similar to TCP. UDP stands for user datagram protocol UDP is a simplest transport layer communication protocol available of the TCP/IP protocol suit. It involves minimum amount of communication mechanism. UDP is said to be an unreliable transport protocol but it uses IP services which provides best effort delivery mechanism.
In UDP the receiver does not generate an acknowledgement of packet received. An in return the sender does not wait for any acknowledgement of packet sent. UDP is also for sending and receiving data but the main difference is that UDP is connectionless. Which means that it does not establish a session and it does not guarantee data delivery.
When a computer sent data to receiver it doesn’t really care if the data is received at the other end or not. And that’s why UDP is known as “Fire and forget” protocol, because it seems that it doesn’t really care what happens to it. Because of less overhead that’s involved of not guaranteeing data delivery, UDP is faster than TCP.