Skip to 0 minutes and 3 secondsA protocol is a set of communication rules that allow you to interact with devices across a network as long as those devices know how to use the protocol as well. A protocol provides a template for sending data called a frame. It describes all the rules for what needs to be sent and in what order. It also dictates the size of the messages that you can send and receive. A protocol also gives you access to a set of features that you can use in your applications, depending on the layer it operates in. Application layer protocols have features that allow the end user to interact directly with services.
Skip to 0 minutes and 41 secondsLower level protocols, such as those on the internet in link layers have features that enable transportation to the data and handle IP addresses. When you enter a URL into your browser, you're telling it to find and retrieve the web page using the Hypertext Transfer Protocol Secure, or HTTPS. But the protocol doesn't know how to find the web page. So first your browser sends a request to a Domain Name System, or DNS, server. This request uses the DNS protocol to fetch the IP address of the web server where the web page is stored. The DNS protocol provides a framework to ask questions to the server.
Skip to 1 minute and 24 secondsThe question requires a domain name and the request for an address record, which stores the host IP address. Once your browser has the IP address, it will use HTTPS to request the web page from the server. HTTPS has a few features you can use. The most frequently used is GET. This request will get the web page linked to the specified host. Other HTTPS requests include PUT, POST, and DELETE. HTTPS requests use TCP to transport the request. This reliable communication ensures a server is listening before sending the request, guaranteeing a response. TCP frames contain information about the ports to be used on both sides and have designated bits for acknowledgments and other flags.
Skip to 2 minutes and 17 secondsTCP is a transport layer protocol and requires lower level protocols to specify the destination IP address. Next the browser uses the IP protocol to set the destination of the HTTPS request. The IP protocol encapsulates a request in TCP frame in another template. A header is added specifying the destination from the DNS question and source IP addresses for the data. Finally, the packet has to navigate the link layer. This is the physical hardware used to transport the data across the internet. There are many link protocols. And as a packet travels across connections, the protocol may change several times until it eventually reaches its destination.
Skip to 3 minutes and 10 secondsWi-Fi is one of the most prevalent link protocols. What information might be needed for a Wi-Fi connection? Share your thoughts in the Comments section.
It's protocols the whole way down
Over the course of the past two weeks, you have seen and heard about protocols and how they govern our communication via networks. In this step, it is time to focus on this aspect of networked programming and discover what protocols are and how they are used.
What is a protocol?
A protocol is a standard set of rules used to ensure the proper exchange or transfer of data between devices.
It provides both a framework and a set of features that applications can use. Observing the rules laid out in a protocol allows you to interact with devices across a network, as long as those devices know how to use the protocol, too.
Protocols provide a template for messages, describing what needs to be sent and in what order. They will also dictate the size of the messages you can send and receive. The template used to send data is called a frame, and you can see an example below:
A set of features
Protocols describe rules, but the template and other guidelines are designed to enable access to a set of features you can use in your applications. These features will depend on the layer the protocol operates in. Application layer protocols will have features that allow the end user to interact directly with services. Lower-level protocols, such as those on the internet and link layers, have features that enable transportation or handle IP addresses.
A packet and its many protocols
When you enter a URL such as
https://www.raspberrypi.org you are telling your browser to find and retrieve the Raspberry Pi home page, using the
HTTPS (Hypertext Transfer Protocol Secure) protocol to do so.
HTTPS protocol provides a framework that will communicate a request for a webpage to a web server, but this protocol knows nothing about where the webpage is stored, or how to connect to it. Your browser will first send a request to a Domain Name Server (DNS) to get the IP address of the web server where the webpage is stored. It uses the DNS protocol to do so.
DNS provides a framework to ask the server questions. A question requires a domain name (raspberrypi.org) and a type of record that you want to access. In this case, your browser will request an A (short for address) record, which stores a host IP address for the domain name.
Once your browser has the IP address (assuming the DNS request was successful), it will use the HTTPS protocol to form a request for the webpage from the server.
An example HTTPS request can be seen below:
GET / HTTP/1.1 Host: www.raspberrypi.org Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36 ....
The HTTPS protocol has a few features you can use; the most frequently used is
GET, which you can see in the request above. This request will get the home page that is linked to the host specified.
Other HTTPS request types are used to replace a webpage (
PUT) or remove it from a server (
DELETE), or to send the content of the current page (
POST), which is used to submit data.
HTTPS requests are transported using TCP. This reliable communication ensures a server is listening before sending the request, thus guaranteeing a response.
TCP frames contain information about the ports to be used on both sides, and have designated bits for acknowledgements and other flags.
TCP is a transport layer protocol, and requires lower-level protocols to specify the destination IP address.
Next, the IP protocol is used to set the destination of the HTTPS request.
The IP protocol encapsulates (wraps) the request and TCP frame in another template. A header is added, specifying the destination (returned from the DNS request) and source IP addresses for the data.
The final layer the packet has to navigate is the link layer: the physical hardware used to transport the data across the internet.
Link protocols are numerous and will change along the packet’s journey. Each connection the data travels across could cause a change in protocol.
The frames (templates) used on the link layer will all have the following information:
- The destination and source hardware addresses, known as MAC addresses
- The length of the data and frame
- A checksum for the data
- The timing and gap between packets that are to be sent
The list above shows you some of the information contained in link protocols. One of the most prevalent link protocols is WiFi.
What other information might be needed for a WiFi connection? Post your thoughts and reply to others in the comments section.