closed account (S6k9GNh0)
What is networking? It's a collection of something that send data from one something to another. This could apply even to humans if you consider sound a type of data, business, etc.. However, we all have to learn how to properly communicate with one another. It's no different with computers; you have to sit down and learn the specifics, it's like learning a language all on its own. However, with computers, we can screw up and be okay (unlike in real life) and as a result, we can use that to test and experiment to speed up the learning process! We continue on to interfacing with the network...

Just following Protocol...
Networking... has *never* been more simple than it is today (:D). Generally, your specific OS will provide you with some sort of basic API to use. Before I move on to that, I'd like to explain the internet really fast.

This is your common "internet". Please note this is usually for general areas and isn't concerning the big picture. However, I'm not worrying about that in this tutorial as this information isn't needed while "networking". This is just to help wrap your mind around it. When you think about how data gets to one another, you can think of this structure.

Also, data isn't just sent out to the internet to explore for a few hours until it reaches its destination. No, it uses something called the "internet" layer to route where it is going. Generally, you'll see use of the Internet Protocol here (please note that an IP address is of course part of the IP protocol).

Overall, we can picture a packet (a packet is simply a structure of data) with four layers. These layers are generally called the link (hardware) layer, the internet (routing) layer, the transport (control) layer, and the application layer. Together, this makes up for the Internet Protocol Suite. The packing of these packets are almost *always* abstract to us. We can program without knowing about this entirely. Most of these layers are self explanatory. To clarify though, the hardware layer helps a packet come back into a network of computers, the routing layer helps a packet reach the network at all, the control layer adds rules to the packet to help a programmer assure a packet presense, and an application layer filters the data that came with the packet to be useful to the client in some way.

When we program, we generally create the application layer (whether we know it or not). However, all that's required for a packet to be sent is the routing layer (so it knows where to go). The transport layer and application is not actually required at all! However, without the transport layer, there is a possibility that our data will get to its destination corrupt, out of order, or just not at all! The control layer "fixes" this to some extent, usually by providing some type of rules that we can follow (depending on the protocol used). Without an application layer, there would be no purpose to the packet.

More here in a bit... I might need to post this up elsewhere as the word limit might be reached :/

4/29/2011 EDIT: I'm still working on it. Windows 7 decided to blue screen me then not want to do anything else... I have absolutely no idea what happened, it doesn't seem to be a hardware issue (other partitions function fine), and I just decided a fresh install was in need (losing my example... since I forgot that I could just fetch the file from another functioning partition...)
Last edited on
Definitely use SFML's Network library.
Will comment when the (EDIT: whole) article is written.

Last edited on
*good heavens, I totally the whole article
More here in a bit... I might need to post this up elsewhere as the word limit might be reached

This wouldn't matter if you use a new post instead of trying to edit your old one.

That image is FAR too neat to be an actual representation of the internet. You don't even try to show how the different Tiers of telecom service providers interact with eachother, how DNS works. I guess we'll keep it introductory so as not to lose people.

If you're continuing one this route by the way (That is from the perspective of a programmer) you should specify that you'll ignoring the infrastructure behind the transport layer. Otherwise I think trying to explain EVERYTHING that is involved would require a Wikipedia sized article.

Good start though, I'm interested to see where this leads.
Last edited on
closed account (S6k9GNh0)
Computergeek01, I do mention that the tutorial isn't quite based on the internet itself. Wikipedia actually has images for both of those but I wanted to keep it simple :D.

As for the second comment, it's required that you have some knowledge of how the transport layer works or else the obvious question between which protocol to use would be there (the routing layer often isn't in question as in almost all cases, this is the IP protocol) . For instance, the official minecraft server uses TCP when it's rather obvious that was a mistake. People often ask me why does it matter and often argue it doesn't matter at all, when it's rather apparent to me that it does. I want to make apparent the purpose of the protocol for that reason alone. I don't plan on going in depth, simply what the difference is and in which case to use what (generally though, only TCP and UDP are used. I'll discuss raw sockets a little bit).
Last edited on
closed account (S6k9GNh0)
Can someone explain why Windows did not follow BSD (or POSIX) sockets API? It's incredibly frustrating trying to make a "cross-platform" example simply because I'm trying to adapt to how winsock does things as compared to POSIX sockets through macro defines, etc.
Last edited on
Windows has a long history of being different from standards. Due to their size and market share, they sometimes come out with their "own" standards and hope other market players follow "their" standards. I do see this behavoir in Apple isn't it ? :P

Just think of IE in the early days, they come out with lotsa features that are not even in the standards but to their credit, some of those features later become part of the standard.

So to follow or not to follow standards for implementation has it's pros and cons.
closed account (S6k9GNh0)
Hmmm... I can understand that.

Btw, I have this rather lanky macro-ridden BSD-sockets based example to show. However, I don't really like it as it's difficult to relate to pure networking. The abstraction from the OS isn't really there which when using some C++ library, will almost ALWAYS be there. I can't tell if that's a bad thing or good thing. But, due to the lack of readability and my inability to have an understanding reader without explaining unnecessary things such as file descriptors, the different API's, poor error handling, etc. I'm thinking about using a library that better represents networking with abstraction such as Boost ASIO or perhaps even SFML sockets. I can see why Beej didn't include error checking in his basic examples which I might do myself but I'm kinda scared to do so.
@ sohguanh: Apple and Microsoft business patterns are so simular because Bill Gates used to work for Steve Jobs. I think I remeber something about them growing up together but I can't remeber if that was true or not.
Topic archived. No new replies allowed.