Networking Protocols#
What is a protocol? It is, in short, like a set of rules that defines how two computers on a network (or even across networks on the other side of the planet) talk to each other, exchanging information they can both use. You're doing this constantly when you browse the Internet, use mobile apps like TikTok, and make a phone call.
Websites are delivered on the back of HTTP
, which is a protocol, and you're using it right now to read this course, because the course has been transmitted to you via the HTTP
protocol. This protocol has a system of rules that define how software "talks" to other software "in" HTTP
. Your browser "spoke" HTTP
to my web server, which understands and also "speaks" HTTP
.
It's like the English language and Mandarin - they have grammar and structure and rules. They're a system of communicating. I'm using English to write this book which in turn you're reading, in English, to understand it. If you somehow tried to read this book but you didn't know any English, then you would fail because you don't use the system of rules; the same protocol.
The written language - English, Mandarin, German, etc. - is a system of rules, a protocol, for transmitting data between people.
The HTTP
protocol is a system of rules, a protocol, for transmitting data between computers.
An example#
I can actually show you an example of "talking" HTTP to a remote web server. Don't worry about understanding everything right now. Just remember that you're looking at an example of a conversation between my local computer and the remote server(s) that is google.com
.
This is me connecting to google.com
:
1 2 3 4 5 |
|
The nc
command line tool is known as netcat
. I'm giving it two parameters: google.com
and 80
. That means I want to connect to google.com
and I want to connect to it on port 80
(more on ports later.)
After that connection is made I start "talking" HTTP
(version 1.0
) to the server:
1 |
|
Here I'm using the HTTP
"verb" GET
, which means I want to get something from the remote server. I'm continuing the conversation with three additional pieces of grammar:
1 2 3 |
|
We'll cover these kinds of headers when we look at HTTP
in detail later on. For now just understand I'm using the HTTP
language to "talk" to the remote server at google.com
on port 80
.
After I press return (enter) a few times the server talks HTTP
back to me:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
It's not happy with my request but in short google.com
replied saying:
1 2 |
|
Which are the important parts of this conversation and they mean: send the request to http://www.google.com/search?q=hello
instead.
Even though the conversation didn't get me the (search) results I wanted I was successful at talking HTTP
to a remote web server.
That's what a computer/networking protocol is: a language and set of rules for establishing a channel of communication and then transmitting information to each other.
The Internet Protocol Suite#
There is a suite of protocols that you might have read about or heard of called "TCP/IP". This is actually two protocols - TCP and IP - but it's also just a name for what is a much bigger suite of protocols.
These protocols are what we're going to go over throughout this part of the course.