 So we we're trying to look at the the TCP connections and using net stat to look at that So we're going to use net cat to create a simple TCP connection And I'm going to do it in some different terminals so that we can see it all at the same time so On computer 10 so the blue one is computer 10 the green one is 13 Okay, 10 and 13. I'm logged into those Computer 10 down here. I'll start the net cat server To start net cat in server mode minus L Tell the net cat software to listen and we need to choose a port and the port is a 16-bit number So it goes up to about sixty five thousand in practice. We need to choose a number greater than a thousand and twenty three So I'm less than sixty five thousand. Here's a simple one. So this tells my sir net cat software to listen listening on port one two three four five and It's listening now and still on computer 10. I now use net stat Let's show me the TCP connections and let's show me the ones which are listening on this computer and There's a number of Essentially servers running on my computer. There's number of pieces of software listening on my computer. Well, we do recognize this one There's some software on my computer and it's listening on port one two three four five and that's the net cat software That's what I noticed there Now the other information maybe the address information this all zeros means Anyone is listening for any particular address And that is anyone can connect to it We notice some other ports if we look through the ports here. Here's port 22 There's some software running on my computer listening on port 22. What is that software? It's the secure shell server every computer when they boot up that automatically starts a secure shell server It's called the SSH demon SSHD is the software So there's a secure shell server now. There's another entry for 22 here. This is for IPv6 connections IP version 6 This is for IP version 4, but the key thing to point the order to realize from the output of the port numbers here Sometimes there's both IPv4 and IP version 6 sometimes There's just IPv6 which covers IP version 4 bit confusing Note just the port numbers port 80 Every computer is running a web server Port 22 every computer is running a secure shell server. Here's my computer running the net cat server What about the others? 3306 What is it? When you saw it did you look in the services file for 3306? MySQL we're running the MySQL database server on these computers. So it's listening there Now the slight difference It's listening only on the local the special loop back address meaning You cannot connect to my MySQL server from your computer You must be on my computer to connect to my MySQL server So that's the difference here that all zeros means anyone can connect this one means You have to be on my computer to connect to my server. So you can't communicate across the internet 631 is the internet printing protocol It's for communicating with a printer 25 is for email. This is just for local email delivery not for out on the internet and I think that's covered up them all So there's some software running on your computer that listens My net cat server is still running. So now I go to computer 13 and I connect 210 I would connect to the IP address computer 10 port number Send my message Check in the output of net stack and I see that Computer 13 Is connected to computer 10 the connection is established. They still connected net cat user TCP by default Foreign address is listening on port one two three four five and My net cat client when I started it was given the port four seven nine nine zero the operating system gave it to it We don't do it as the user So this shows the active connections or the current connections If you add the minus L you show the servers listening One thing you may have noticed the server is still there. I can still send back But if we look at the listening connections, it's no longer there That is there's no longer one listening connection on port one two three four five That is because net cat is a very very simple server as soon as someone connects to it It's no longer listening for others. It's just communicating with that one that Connects so you can't have multiple people connect to the net cat server at the same time real servers Normally when someone connects It creates a child process to deal with that client and then listens for more connections That's why all of you can log into my secure shell server. I've got one secure shell server running Whenever you connect it creates a copy of itself and then waits for the next person to connect We'll see that when we look at web servers later So from net stat minus T you can see information about current connections at the minus L and you can see those which are Listening the wise those listening is very useful to know what servers are running on your computer Because that may be potential security floor and that if there's a server running on your computer Then others outside may be able to connect to your server and do things So that's useful to know what's running on your computer when we close I Close the server the clients closed The connection was closed then So I close the connection and it's not even in a time wait state because we haven't communicated So you know what about applications communicating using net stat minus T