 Okay, today we're going to do real-time network communications. So this is just sending stuff really quickly, you know, it's not doing like HTTP requests, which can be considered slow, although are useful for many, many types of communications. But basically this is sending stuff real-time through sockets, which can be done in multiple programming languages. But today we're going to be doing it, you know, using Netcat or NC or Busybox NC. Which is it? Are they all the same thing? I always thought they were the same program, just label different and the Busybox one was a stripped down version of it, which is somewhat true. Basically let's go up here on the screen and I'll run the man page for Ncat and then I'll come over here and run the man page, the manual for Netcat. And you can see that they are different. And you can see that the one that was Netcat is showing as NC up here. So on most systems, NC or the Netcat command, they're going to be the same command on most systems. And then Ncat is a different version of that. And basically Ncat was written for the Nmap project. So Ncat is put out by the same people who make Nmap, which is a port scanner and it's supposed to be an improved version or a newer version of Netcat or NC. And they are very, very similar. A lot of the stuff that they do works the same way except for one may have some features or be slightly different. So you got to be careful about that when you're writing stuff. And then again, if I was to quit out of this and quit out of this, if you have Busybox installed, which Busybox is a single binary that contains a lot of your core tools, one of which is being NC, but they tend to be stripped down versions of that. So it does have NC. And this is on a lot of devices. Your phone, if you run an Android device, usually has Busybox or it might have Toybox, but you can always install Busybox on it. If you get into routers or modems or other embedded devices, Busybox is going to be on there and give you a lot of these core tools and NC will be on there, but it might be missing a few little features. So let's communicate. We're going to start up a server and then we're going to connect to it. I'm going to, let's flip over here. On the left side of the screen, this is the same machine. So I'm just going to loop back to it, but let's just pretend that they're different machines on the same network or even across the internet. If you have the open ports, what we're going to do here is we're going to run NC-K-L4444. So what does that mean? NC. So we're running the NC command, which we just said was the, is the same as the net cat. No, sorry. NCAT command. I got to look over at my notes here to make sure I say that right. And then NCAT, which is the newer version, improved version, the dash K option. That means basically if it's disconnected, start up a new session right away. So we're going to be able to connect to this and we'll communicate and when we disconnect, the server is going to keep running and wait for another connection. If we didn't do that, once we disconnected, it would stop running and I'll show you that as well. And then dash L means listen, and we're going to listen to port 4444. You can use any port you want that is open and is available to user. The dot times lower ports are not available to regular users. You have to be a root user to use them. We're going to use 4444, so I'll run that. And it looks like nothing happens. I can type stuff and hit enter. Nothing happens. Let's come over here. And now we're going to run the same thing, NC, which is the NCAT command. We're going to say, give it a port number. So whatever the port number, the IP address to the machine 127.0.0.1 just means loop back to the current machine using a virtual network device. And we're going to be connecting to it on port 4444. So basically, you would change this to the IP address of the root machine and the port that you chose over here. Let's go ahead and hit enter. And you can see it's actually already received the signal that was originally sent. If I type something, it sends it over there so I can be typing stuff. And whatever I type, it goes over there when I hit enter. And if I come over here and type something, it goes back over there. So we're doing real-time communications. This is a simple little chat program. No encryption here. Anyone on the Nolku network would be able to read this if we're actually using that work and we're using a loopback machine on the same machine. But if we're actually talking to another machine, there's no encryption here. But we are quickly setting up a little chat program that's going both ways. And again, we could be doing this with multiple languages, which I'll show you in a moment. But let me come over here and let's try writing the same thing. But instead of the NC, which is same as NCAT, let's try netcat. We'll go ahead and hit Enter. And it seems to be running. Let's go ahead and switch over to here. And we'll run this command again. But we'll run it again with NC just to show that they are compatible, because we're just using a socket connection. I'll Control-C. You notice when I Control-C to exit out over here, the server over here is still running. And I can connect to it again, right? If I was to come over to the server here and kill it, and I remove this K command, and then come back over here and reconnect. So let's go ahead and clear the screen. Or I can't clear the screen while that's running. So what I'm going to do is I'm going to connect again. And now I can start sending messages over here. But since I don't have that K option, when I disconnect, the server then stopped. And I cannot reconnect because it's no longer running. So that's what that K option does is it allows the server to keep running after it's disconnected. So we've seen now that both NC and Netcat are compatible. They run the same, whether we're connecting as a client or server. But let's go ahead and try it with the busybox version, which is a stripped down version of NC. So let's go ahead and let's start off with our server over here. So I'm going to run it with the K option. And if I come over here, I'm going to say busybox. And I'm going to say the same command, connect back here. And it's working. Great. Now let's disconnect. And you can see our server is still running because we had that K option there. Whoops. Whoops. We'll run this again. And we're still able to connect. So control C, control C. OK, let's run our server over here again using the NC command. But we'll do the busybox. So NC is going to be our server. And I'll just do dash L for now. And I will connect back to it over here. Let's see. Oh, got it. Actually hit Enter over here to start our server. And already I'm having an issue here because of the, let me see. That's right. OK, that took me a second here. I had the same issue when I was testing this out. And I forgot what the answer was. So it's able to run as a server. And we're going to listen. But with regular netcat NC or NCAT, you just say listen and give it the port. With the busybox version, you have to say dash P and then give it the port number. So now it's running as a server. So there is a slight difference. It works. But you need to do that dash P option. So you need to be aware of what version of NC you're running. And then we can come over here and we can say connect to that using the busybox option. And we're good to go. So yeah, that's a slight difference there. One other difference is the NC in busybox does not have the K option. I don't think looking at the quick help file, I don't see anything that allows that to restart. So basically if you want to run this as a server on a lightweight machine that has busybox and you want to keep going, you'll probably have to put it in a while loop of some sort. So I guess I haven't tried this, but you should be able to do something like this. While one and the spaces there are important do and then over here done. So we're running it. And basically I can connect to it, blah, blah, blah. And when I hit enter, it sends it. I can hit control C to disconnect. And the while loop basically just restarts the program again. So the busybox version doesn't have that option to automatically restart server on disconnect and keep listening, but you can easily do it with a while loop. Now I wanted to show you something a little bit more. So let's go ahead and just kill this. And let's see. Let's just do, doesn't matter which one we do here. We're going to listen on port 4444. Let me switch over here to here. OK, so here we have the same thing. Let me go ahead and make this a little larger. So again, we're running our NC here, our NCAT. NC is NCAT. Yeah, I have to keep looking at my notes to remember which one's which. We're listening on port 4444. And over here, I have a simple Godot script, the game engine. And I have set up some socket client information here. And so I should be able to hit F5 to start this over here. And now what I have it set up to do is it's calculating my mouse cursor position and sending it over to NC. And this is an example. I could be sending any type of text over there. I could be sending words, numbers, integers, floats. But what I'm doing is I'm sending my mouse cursor position within the window here. So think, hey, you can use this theoretically to send your mouse cursor position maybe from an Android device, since Godot can compile for Android, or even a desktop. And you can send that to another machine and maybe control your mouse cursor over there. That is something that's already a functionality that's built into other applications like KDE Connect. But if you want to write your own, you can now send quickly. You can see as I move the cursor around, it's quickly sending over the X and Y position of my mouse cursor. And you can translate that over to the screen size of another machine. And you can control the mouse while you have to do is add a click function. So just the thought of something that you could use this for, but there's lots of things you can use this for. But again, remember, the way we have this set up right now, it's very, very simple and there's no encryption. So if there's anybody on your network, or if you're sending this out into the internet, that it's going to be able to read by anybody and could also be intercepted and manipulated and transferred. But in a pinch, especially if you're on your closed local network and you need to get something done quickly, this is a way to do it. So I just thought I'd share this. Socket connections are very useful, fun. You could do these in web pages using JavaScript these days. So it's very useful. And I just wanted to show you how easy it was using NetCat, which is a great tool. It's the Swiss Army Knife of networking. So I thank you for watching. And as always, please visit filmsbychris.com. That's Chris at the K. There's a link in the description to my website, as well as my Patreon page. Check that out. And as always, I hope that you have a great day.