TCP vs UDP Comparison
Taiwo Amao
Technical Support Engineer @ Moniepoint Group ? DevOps ?? ? Cloud Migration ? 5x AWS ? 2x Azure ? Platform Engineer ? AWS Community Builder ??
Whenever a computer wants to communicate with another computer, the communication between these two computers needs to be good and reliable. So we can guarantee that the data is received correctly. For example, when you want to view a webpage or download a file, or look at an email, you'd expect to view the webpage intact and in order with nothing missing, or if you're 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, then it wouldn't be of any benefit to you. So this is where TCP comes in. TCP stands for transmission control protocol and this is one of the main protocols used in a TCP IP network. And TCP is what is used to guarantee that all the data is received and in order, because without TCP, then some of the data could be missing or out of order. Because if you view a web page, without TCP, your webpage could be all messed up, the images could be missing, or the text could be backwards and out of order or if you download a file, then you might not get the entire file, or you could get the file out of order, which would render the file useless. So again, this is where TCP comes in.
Now, 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 a three-way handshake. The first step is that a computer will send a message called a SYN, then the receiving computer will send back an acknowledgement message (SYN ACK) telling the sender that it has received the message. And then finally, the sender computer sends another acknowledgement message (ACK RECEIVED) back to the receiver. Once this has taken place, data can be delivered. Another important thing to remember about TCP is that it guarantees the delivery of the data. So if a data packet goes astray, and doesn't arrive, then TCP will resend it.
Now UDP is very similar to TCP; it 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. So when a computer sends their data, it doesn't really care if the data is received at the other end. And that's why UDP is known as a fire and forget protocol because it sends data and it doesn't really care what happens to it. Another point to remember is because of the less overhead that's involved of not guaranteeing data delivery, UDP is faster than TCP.
PhD Candidate, Cereal Quality Lab Texas A&M University| IFTSA Board Member 2024/2025
3 年Well done Taiwo
Beautifully delivered
Devops and Support Engineer | Data Analytic Enthusiast | Business Leader
3 年simple and straight to the point . love it