

UDP is less reliable than TCP, but is much simpler. UDP, or User Datagram Protocol, is another one of the major protocols that make up the internet protocol suite. Once your device receives all the data it needs to render the article, TCP automatically terminates the connection between the two devices with a method similar to the three-way handshake, this time using FIN and ACK packets. If any packets are lost along the way, TCP makes it easy for your device to let the server know it's missing data, and for the server to resend those packets. TCP ensures that these packets all arrive to your device. Your device then reassembles those packets into the files and images it needs to render this article.
Learn tcp ip fast code#
So when the freeCodeCamp News server sends the HTML, CSS, images, and other code for this article, it breaks everything into small packets of data before sending them to your device.

Those packets then need to be reassembled on the other end. Going back to the example of your device and freeCodeCamp News, once the three-way handshake is complete, the News server can start sending all the data your device's web browser needs to render this article.Īll devices break up data into small packets before sending them over the internet. Once a TCP connection is established between two devices, the protocol guarantees that all data is transmitted. When your device receives the SYN-ACK from the server, it sends an ACK acknowledgment message back, which establishes the connection. Then the freeCodeCamp News server sends back an acknowledgement message called a SYN-ACK. To establish a connection between two devices, TCP uses a method called a three-way handshake: Sourceįor example, to read this article on your device, your device first sent a message to the freeCodeCamp News server called an SYN (Synchronize Sequence Number). TCP is a connection-oriented protocol, meaning that it establishes a connection between two devices before transferring data, and maintains that connection throughout the transfer process. Without TCP, images or text could be missing, or arrive in the incorrect order, breaking the page.

TCP is used in situations where it's necessary that all data being sent by one device is received by another completely intact.įor example, when you visit a website, TCP is used to guarantee that everything from the text, images, and code needed to render the page arrives. TCP is extremely reliable, and is used for everything from surfing the web (HTTP), sending emails (SMTP), and transferring files (FTP). TCP, or Transmission Control Protocol, is the most common networking protocol online. Here's a brief comparison between the two: Sourceįor an even higher-level overview of how the internet works, check out this five minute video: What is TCP? And whenever two devices communicate over the internet, they're likely using either TCP or UDP to do so. Both TCP and UDP are major protocols within the internet protocol suite: SourceĮach device that's connected to the internet has a unique IP address. The internet protocol suite is a collection of different protocols, or methods, for devices to communicate with each other. Each device, whether it's your smartphone or a server, communicate through the internet protocol suite. Generally speaking, the internet is a network of connecting devices. Computer Networking Basicsīefore diving into how TCP and UDP work, it's helpful to know the basics about how the internet works. In this article, we'll go over computer networking basics, the differences between TCP and UDP, when each is used, and more. TCP and UDP are different methods to send information across the internet.īut even knowing what they stand for, it's hard to know which protocol you should use, or why you would use one over the other. TCP, which stands for Transmission Control Protocol, and UDP, or User Datagram Protocol, are part of the internet protocol suite. If you're getting into computer networking, or if you've dug through the network settings of some applications, you've likely seen these terms: TCP and UDP.
