What is The Difference Between TCP vs UDP?
Just like us humans it’s important for computers to have a common way to communicate with one another. Most computers if not all will do this through TCP/IP. This is normally built in to most computers and is largely automated, however it can be very useful to understand the TCP/IP model, especially when you are setting up a computer to connect with other systems. TCP/IP is definitely by far the most commonly used protocol suite on the web. Millions and millions of people use it on a daily basis, they might not even realise it!
When setting up your internet router you may have heard of both TCP and UDP. You would have most probably also came across these terms when configuring firewall software or looking through VPN features.
Do you know the difference between the two? Firstly you should know exactly what they are before you try to even understand the difference between them.
TCP stands for Transmission Control Protocol. It is a connection oriented protocol that computers will use in order to communicate over the internet. Not only is it one of the main protocols in TCP/IP networks it also provides error checking and it guarantees that the delivery of data and also that packets will be delivered in the very same order that they were sent.
UPD stands for user data gram protocol. It is a connectionless protocol that works exactly like TCP however it assumes that error checking plus recovery services are not really required. Whether they receive them or not a UDP will still continuously send datagrams to the recipient.
Although they have many similarities they also have many differences too. They are by far the most commonly used protocols for sending packets over the internet. Both of them work on the transport layer of the TCP/IP protocol stack, both also use the IP protocol too.
Listed below are some of the main differences between the two protocols.
Connection/ connectionless, what’s the difference?
UDP is in fact a connectionless protocol, and TCP is a connection oriented protocol. What a TCP does is it establishes a connection between both the sender and the receiver, this is done before data can even be sent, whereas UDP doesn’t establish a connection before sending data.
TCP is very reliable, any data which is sent while using a TCP protocol is 100% guaranteed to be delivered straight to the receiver. If on a rare occasion data is lost if transit it will eventually recover it and then resend it straight away.
So that data is not lost or corrupted TCP will check packets for possible errors and track packets.
UDP doesn’t provide 100% guaranteed delivery therefore it isn’t really reliable at all as a data gram packet may possibly become lost in transit or even corrupt.
What TCP does is it uses a flow control mechanism, this insures that a sender is not overwhelming a receiver by sending way to many packets at one time. It will store data in a send buffer and it receives the data in a receiver buffer. It will read the data from the receive buffer once the application is ready.
Sometimes it can be that the receiver buffer is full, in this circumstance the receiver wouldn’t be able to handle any more data, what would be the outcome? It would drop it!
In order to maintain the exact amount of data that can be sent to the receiver, the receiver would tell the sender just how much spare room there is available in the receiver buffer.
Every single time that a packet is received, a message will then be sent to the sender and included will be the valve of the current receive window.
Unfortunately UDP doesn’t provide flow control, basically packets will just arrive in a continuous stream or they will simply be dropped.
What TCP does is called ordering and sequencing, this guarantees that all of the packets sent from the server will 100% be delivered to the client in the same order as they were sent to them in the first place.
Again UDP doesn’t operate in this way and will send packets in any order at all.
What might be surprising to some is that TCP is actually slower than UDP, this is because TCP has a lot more to do which is obviously going to slow it down! First TCP is to establish a connection, then it has to error check and 100% guarantee that the files are received in the exact same order they were sent.
TCP is most definitely suited for applications that require a high level of reliability especially when timing is less of a concern.
. Secure shell
. World Wide Web
. File transfer protocol
UDP is great when it comes to efficiency and speed therefore it’s best suited for applications that require this such as :
. Streaming videos
. VPN tunnelling
. Live broadcasts
. Online games
. Voice over Internet protocol
. Trivial file transfer protocol
. Domain name system
HOW CAN I POSSIBLY TELL WHAT MY TCP/IP ADDRESS IS?
Most if not all devices have their very own TCP/IP address, normally each device can communicate automatically, however sometimes you may need to manually provide your TCP/IP address, it’s not something difficult to do. It’s very important to understand that TCP and IP are two completely separate computer network protocols.
The IP is the part that obtains the address to which data is sent, whereas TCP is responsible for data delivery after the IP address has been found!
Some friendly advice! Protecting your IP address is also very important, it’s just as important as your telephone number, obviously you don’t need to hide it from everyone but you also don’t want to shout it from the rooftops either, so why not encrypt your packets with a VPN! A VPN is definitely the best way to insure that your data is encrypted and your packets are protected when they travel.