The Ultimate Guide to Tcp Vs Udp

hackersque
3 min readJan 23, 2021

Whenever a computer wants to communicate with another computer, the communication between those two computers needs to be good and reliable, so it can guarantee that the data is received correctly. For example, when you want to view a web page, or download a file, or look at an email, you’d expect to view the web page 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 web page 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. So the first step is that a computer will send a message called a SYN. S-Y-N Then the receiving computer will send back an acknowledgement message telling the sender that it has received the message, and then finally the sender computer sends another acknowledgment message back to the receiver. And then 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. UDP is also for sending and receiving data. But the main difference is that UDP is connection-less. 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 the “fire-and-forget” protocol, because it sends data, and it doesn’t really care what happens to it as this demonstration will show. Another point to remember is because of the less overhead that’s involved of not guaranteeing data delivery, UDP is faster than TCP.

Originally published at https://hackersque.blogspot.com on January 23, 2021.

--

--