C++ Qt 63 - Introduction to Network Programming Concepts

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
everybody its Brian and welcome to the 63rd cute tutorial will C++ and GUI programming today we are not actually going to write any code today we're going to begin a primer for network programming so if you're already a networking guru go ahead and skip this video however if you've never done any network programming it'd be a good idea to pay attention we're going to go through this fairly quickly and I'm going to try and condense probably about the two or three weeks of college classes into about 15 minutes so if you don't understand what I'm talking about the first time rewind the video and rewatch it and hopefully it'll sink in alright now you all know how to surf web pages I mean you're on YouTube so I imagine you know how to get from point A to point B but do you understand how that really works well in order to do that you have to go through a series of networks and let's just go to Google Images I'm just going to show you a couple things and one thing it uses is called TCP or transmission control protocol and you can see how it's got this little image here of these computers and it goes you know into these little networks and it chains around that's actually how the internet functions when you send a message from point A to point B it doesn't actually go from point A to point B it goes through all these little networks and circuits and gobbly out on the internet a little out of the scope I just wanted you to understand that there's a whole network and there's a big mesh of networks that if it has to function together there's two types of protocols you're going to be working with there's TCP and what that means essentially is you are creating a connection TCP has a three-way handshake and the three-way handshake is basically a you send a send packet then you get a syn ACK response and you send an ACK packet back now that happens transparently you don't see any of this going on but you should know that when you use TCP there's an actual handshake and a connection so you verify there's a circuit there now there's UDP which I don't know if we can even really find a reliable graphic for UDP but we'll try whoops USD don't want that you DP yeah this is probably a pretty good representation right here of the difference the TCP we have a connection with UDP it's connectionless meaning you just fire the data off and forget about it you don't even know if it ever reaches the destination or not why would you want something like that while UDP is much faster because it doesn't have that overhead of the three-way handshake now as you can imagine though the internet would not function very well with UDP because you need that that reliability of that connection you need to know when the connections drop you need to know if the data is corrupted or just doesn't make it there hmm excuse me um one other thing you should note is DNS let me pull up this graphic here and this is kind of look very unfamiliar most you what is DNS well when you type in google.com that's DNS basically DNS translates an IP address to a friendly name for example when you go to Google and let's just try to find let's just find out who is who is lookup will tell us who owns something so let's just go here who is and just type google.com and you can see google.com and all the information about it you can actually you know contact customer support you can view their IP ranges and here's their name servers now what's a name server well that goes back to DNS what that means is when you type google.com it's actually going through the root server and then it's going to the dot-com server and there's actually a group of these servers it's not just one server in a basement somewhere and then it says okay who owns Google then it forwards it over to Google's name servers and then you know one of these guys right here and as one through four picks it up and says okay where do you want to go within Google so you know kind of go out and play with who has lookups and figure out you know who owns what now with that I'm going to pull up a command prompt here and if you don't know how to do this just go start run type CMD and hit enter and that'll bring up this command window and you're going to learn some basic networking commands for example if you type an IP config and hit enter you'll see a whole lot of information here and you see I have an IP version 6 address and an IP version 4 address now what's the difference between these two you note that the IP version 4 is much smaller and probably similar to what you're used to seeing where the IP version 6 is much bigger well we're running out of IP version 4 addresses on the internet so we're all slowly transitioning the IP version 6 now you should know this is not my actual IP address on the internet this is my local IP address remember that at TCP diagram we had let's see if we pull that up again so this would be my computer this would be my home router and then this would be my ISP in this case Comcast and that forwards off to you-know-who they're chaining through and then it goes through this mash and there's a whole bunch of protocol and gobbly that happens in here that eventually gets to the end point now this default gateway 192 168 1 1 that is actually my router it's called a gateway because it acts as a door to another network um think of like I don't know I'm probably dating myself when I say this but think of the the twilight zone series on has a stereo door standing out the middle of network that's kind of what a gateway does it allows you to go into another network and let's actually pull up a picture of a router here just in case you've never really seen one or you don't really know I'm sure you've seen a couple these these little guys right here these routers and what these do is they route traffic that's quite literally all they do is route traffic so you send traffic to it through this TCP and then you say ok I want to go here I want to go there and then it just does what it needs to do whoops lost my command prompt there wait let me bring this back up here sorry about that it's been an incredibly long couple days my my poor cat that some of you been asking about passed away so didn't sleep very well last night all right there we go so that's how you find your IP address and note you can have multiple IP addresses on the same machine now an IP address is just an address don't get hung up on the term IP it's just an address it's like like a post office address it's like a zip code it's like a telephone number it just says we're on the network are you that's all it means now one thing we should cover is go back to DNS do nslookup and do google.com this is what happens when you go to a web page you perform an NS lookup if you haven't already it's all done automatically you contact your DNS server in my case it's this Westlands michigan comcast 9th and there is the address space for google.com right here so what it does is it says ok are you busy yes are you busy yes oh you busy no ok make your connection that's what I mean by you can have more than one IP address now Google com is not one computer sitting at some guys basement it's a massive network so we're actually leasing a very small segment based on the region that we're in so that's what I mean by IP address let's actually take one of these guys let's just a 19 right here let's pull up a web browser and instead of going Google com let's just go to that IP address sure enough it brings up Google so when you go to dub dub dub Google comm it's actually doing it nslookup in the background and saying okay what's a free address for google and it gives you this 7 4.1 25.2 2 25 19 how would you like to type that in every time you wanted to go to google and what a pain so that's what dns does it allows you to say you know like my web server comm org or you know whitehouse.gov that's how that works now the other concept that's very important is the concept of ports what are ports we can have multiple addresses each address can have multiple ports now what do I mean by that a port is a channel that you can connect to and communicate with for example the most common port for web servers is a tea and let's do a net stat - n here and you can see these right here actually these guys down here notice that's Google's IP range 7 for 125 - 25 same thing as up here with this colon and then 80 the colon denotes that you're calling a port so we're calling port 80 and the state is established meaning we've established a connection and I've got my web browser open so if I close that it'll close those connections in the background now you notice how there's also a port on your local side here's my IP address 192 168 1 dot 132 colon 4 9 5 9 3 you don't need to know what any of this is you just need to understand that your computer has an IP address each IP address has multiple ports in order to connect to another computer through you notice the protocols TCP that connection you need to have a local IP address and a port and a remote IP address and a port now when you're programming most of this is done in the background all you need to know is what do you want to connect to what do you want to send what do you want to receive that's all you need to know but I wanted to kind of go through this primer really quickly because a lot of people that are good at programming have never touched networks they have no clue how networks actually function and I think that if you're going to be a good programmer especially with networking you really need to understand this stuff and kind of point in case here if we just go to Planet - source code calm and just go to the dotnet section I realize we're covering you know C++ here and search for my handle which is void realms and scroll down here if you know any dotnet whatsoever you can kind of browse through some of the source code that I've submitted planets source code is just a contest website people submit their source code for peer review and contest and I've won a lot of these contests but I've actually created like a threaded HTTP download in vb.net and you know I've done from scratch an FTP server an HTTP server an FTP client you know etc etc and I've won won this award a few times but so if you're into daunting that you can go out and download and review this and we're going to be doing some of these cute is very very good at this that's one thing I really like about cute is how they handle networking this not as convoluted as a lot of the other languages that I've seen out there but anyways I wanted to show you planet starts going to show you that yes I indeed do know what I'm talking about and I have been doing network programming for a long time and it's challenging so don't get frustrated you just have to know how things work under the hood anyway so I'm babbling this is Brian thank you for watching I hope you found this video entertaining
Info
Channel: VoidRealms
Views: 54,460
Rating: undefined out of 5
Keywords: Qt, 63, Introduction, to, Network, Programming
Id: A9W7cm94iAY
Channel Id: undefined
Length: 12min 34sec (754 seconds)
Published: Wed Mar 23 2011
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.