Skip to main content

Protocols and Web Servers

TCP Protocol

As discussed in previous courses, protocols are sets of rules that enable communication between devices on a network. Each protocol has specific characteristics and is used according to the needs of the application.

In particular, the TCP protocol is known as the reliable messenger of the Internet. When data is sent via TCP, this protocol guarantees that all information arrives complete, error-free, and in the correct order.
You could imagine it as a courier service that requires delivery confirmation: if any packet is lost or arrives damaged, TCP requests it again until everything is correct.

For this reason, TCP is fundamental in applications where data integrity is essential, such as web pages, emails, and file transfers.

TCP Protocol

Three-Way Handshake

Before sending data, TCP uses a process called Three-Way Handshake to establish a reliable connection between two devices. This process consists of three steps:

  1. SYN: The client sends a SYN message to the server to request a connection.
  2. SYN-ACK: The server responds with a SYN-ACK message, confirming receipt and accepting the connection.
  3. ACK: The client sends an ACK message to confirm the server's response.

Once these steps are completed, the connection is ready and both devices can exchange data safely and orderly.

UDP Protocol

On the other hand, we have UDP, which is much more relaxed regarding data assurance. In this protocol there is no delivery verification: data is sent without worrying whether it arrived or not.

UDP is faster than TCP because it does not have to verify every packet, but this means data packets may be lost along the way.

This protocol is mainly used in applications where speed is more important than precision, such as:

  • Video calls
  • Online gaming
  • Content streaming

If a packet is lost during transmission, communication continues without interruption.

UDP Protocol

Web Servers

HTTP Protocol

Now, considering the TCP protocol, we can talk about HTTP servers. Based on the TCP protocol, HTTP (Hypertext Transfer Protocol) was created, which is what browsers use to communicate with web servers. When you type an address into your browser, it sends a request to the HTTP server, which responds by sending the necessary files for you to see the page.

HTTP protocols consist of different parts, presented below:

  • HTTP Method: Indicates the action to perform, such as GET (to fetch data) or POST (to send data to the server).
  • URL: The address of the requested resource.
  • Protocol Version: Indicates the version of HTTP being used, such as HTTP/1.1.
  • Headers: Additional information about the request, such as accepted content type or cookies.
  • Request Body: Contains data sent to the server, if necessary (for example, in a POST request).
HTTP Protocol

Self-Assessment Quiz

Cargando cuestionario...