Networking and Streams

Protocols and Ports

Networking and Streams

Check out a free preview of the full Networking and Streams course

The "Protocols and Ports" Lesson is part of the full, Networking and Streams course featured in this preview video. Here's what you'd learn in this lesson:

James introduces the concept of protocols, which are languages that allow computer programs to speak to each other. Examples of protocols include HTTP, SMTP, IMP, and SSH.

Preview
Close

Transcript from the "Protocols and Ports" Lesson

[00:00:00]
>> On top of these UDP and TCP circuits, we have this idea of protocols. Protocols are literal languages that we use to interact with different kinds of services. So a really common one on the internet is HTTP and HTTPS. HTTPS just has a layer of TLS encryption over HTTP.

[00:00:22]
To send emails we use SMTP, which we're gonna get into. It's actually a very simple protocol that's quite similar to HTTP in some ways. There's also IMAP and POP3, also text-based protocols that you can use to read email messages. There's IRC, which is a really old but still useful text-based chat protocol.

[00:00:45]
Then others like FTP, not used as much anymore, but SSH is still pretty common. So all of these different services, typically, have kind of like a default port. This is not always true. And some of them have several ports that they typically use. FTP is kind of a wild card here because it has a command port.

[00:01:09]
It's kind of designed a bit like how satellites work. Actually, it's pretty interesting because you have a port that you listen on, I think it's 21, or 20, or something, and that's the control port. And then, FTP will actually go ahead and open additional ports when it does a file transfer.

[00:01:27]
And so it's kind of complicated to set up a network config for it for that reason. But it's fascinating because that's also how, if you have a ground station and wanna talk to a satellite, you have usually a low but more reliable control frequency that you use. And then you use a higher frequency that has more throughput to pull down weather raster images from cameras that are pointed at the earth, that kind of thing, so.

[00:01:55]
Kind of a fun way to remember how FTP works, and also, how satellites work. So each of these different kinds of systems lives on a usual port. So these are numbers between 1 and 65,000 or so that differentiates the service on the system, for the most part. You can always run something on a different port.

[00:02:20]
And you have to do because on most systems to bind to a lower port, you have to have admin privileges or you have to have special kind of configuration. So it's pretty common when you're developing to run a HTTP server on port 5000 or port 8000 or something like that.

[00:02:40]
Here's how it was, 21 for the control port of FTP. SSH is usually 22, 25 for SMTP, 80 is HTTP, etc. IRC has got a bunch of them, but I think that's the most common one that's typically used. So here's something that you can all try on your system.

[00:03:04]
If you go ahead and if you have netcat installed, you can try nc- lp 1024, which probably auto works. So right here, when you run netcat with dash l, it listens on a port, and p tells it what port to listen on. So if you try to do 1023, though, it probably won't work.

[00:03:29]
So I'm gonna go ahead and do that on my screen. Whoa, whoa, whoa. [LAUGH] All right, so it's installing something. [LAUGH] So if I listen on 1024, there we go. It works because it's just waiting for connection. I'll get a little more into how to use netcat for testing things.

[00:03:51]
If I do 1023, permission denied. So this is a default kinda policy that most Unix C systems have. I don't know how it works with Windows, but it might be similar, it might not, who knows?

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now