Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2009
    Location
    Bellevue, WA
    Posts
    803

    Network Programming Where To Start

    Hey what's up guys. It's been a while since I been on, I've been busy. I have a couple questions about learning network programming. I am familiar with C/C++ and C# and have been doing game development for a couple years, mainly just projects from school and since graduating just personal/indie type projects.

    While in school I had a class on Networking and it was done using Winsock, but networking was one of those tough subjects that I did poorly in. I've decided to go back and revisit networking as it's something I would like to really learn and get better at. It seems as though there are not as many resources on it as I would have thought (at least aimed at a beginner, most assume you have networking experience)

    I was wondering if any of you out there who have done a lot of network programming and feel comfortable with it, where you got started and what resources you may have.

    1.) What's a good C/C++ networking API
    2.) I have a book on Unix networking, however I would be working in Visual Studio on a Windows machine does this matter? Or would the Unix networking API only be applicable to a Unix OS?
    3.) Are there any good tutorials or books anyone has found for networking aimed at a beginner (I wouldn't mind building on top of the Winsock stuff I learned in school (even though I forgot most of it )
    4.) Also, would be interested in networking from a gaming point of view, maybe building a simple networked pong game.
    " Imagination is the preview of life's coming attractions " - Albert Einstein
    " If you can't explain it simply, you don't understand it well enough." - Albert Einstein

    My Website: http://www.gamedevlounge.com/

    If any post is informative please provide positive feedback by clicking the star below.

  2. #2
    Join Date
    Jun 2003
    Location
    Trier, Germany
    Posts
    1,350
    The underlying API for all network programming is the BSD sockets API, which is implemented as Winsock on Windows. It's a very simple API, so you shouldn't have any trouble learning it with the right learning materials. I'd recommend the excellent tutorial by Beej. It's available for free on the web and gives a good introduction to the API with a lot of sample code. Since the socket API is rather small, I found Beej's guide to be completely sufficient when I first started with network programming.

    The main problem with sockets is, that they are the lowest common denominator. It's a very powerful low-level C API, but it really does not do anything beyond sending single packages over the network. In other words, it's pretty much impossible to write non-trivial network applications without introducin more layers of abstraction.
    The best one I know for C++ is boost.asio, which also happens to be part of the TR2 extensions for the C++ standard library. Asio is a *lot* bigger than sockets, but if you plan to write actual network applications in C++ and not just some trivial demos, there is no way around it. The documentation at Boost's website is excellent and should contain everything you need to get started. Unfortunately, it's quite a sophisticated read, so you will want to look at sockets first and maybe even use an additional tutorial when starting with Asio.

    The only book I know on the subject is Stevens' TCP/IP Illustrated, a three volume monster and the last book you'll ever need on fundamental network programming. It discusses the subject in great detail, including a discussion of the full implementation of the network stack up to the socket API in volume 2. This is not a beginner's book and mainly focusses on how network protocols tick on the inside, rather than how to use them as a programmer. But if you really want to know what's going on, get a copy from your local library. Previous experience with programming sockets is highly recommended though.

  3. #3
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750
    You might be interested in watching the network programming tutorial series that I posted on my website here: http://www.marek-knows.com/downloads.php5?vmk=network
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  4. #4
    Join Date
    Jun 2009
    Location
    Cyberspace
    Posts
    120
    Take a look at enet it was made for games.
    Badges are beneath me.

  5. #5
    Join Date
    Mar 2009
    Location
    Bellevue, WA
    Posts
    803
    Thanks guys for all the information. I'm still wondering about Unix Network Programming, can I use the Unix Sockets in a windows environment using visual studio? I only ask because I have a book that was given to me on the Unix Sockets API. More than likely I would probably only be able to use WinSock though. Thanks DarkOn I will check out that API too. I feel like there was another popular API for game networking using C++ too but I can't remember it right now.
    " Imagination is the preview of life's coming attractions " - Albert Einstein
    " If you can't explain it simply, you don't understand it well enough." - Albert Einstein

    My Website: http://www.gamedevlounge.com/

    If any post is informative please provide positive feedback by clicking the star below.

  6. #6
    Join Date
    Jun 2009
    Location
    Cyberspace
    Posts
    120
    Quote Originally Posted by Kwest
    I feel like there was another popular API for game networking using C++ too but I can't remember it right now.
    Go here scroll down a bit and you will find a list of many APIs for every thing from a multiplayer FPS to a MMO.
    Badges are beneath me.

  7. #7
    Join Date
    Mar 2009
    Location
    Bellevue, WA
    Posts
    803
    Thanks DarkOn that's a pretty good list of API's the one I heard of and couldn't remember was Raknet and it was on the list. I went to their site and saw that it supports C# as well now which is good.
    " Imagination is the preview of life's coming attractions " - Albert Einstein
    " If you can't explain it simply, you don't understand it well enough." - Albert Einstein

    My Website: http://www.gamedevlounge.com/

    If any post is informative please provide positive feedback by clicking the star below.

  8. #8
    Join Date
    Jun 2003
    Location
    Trier, Germany
    Posts
    1,350
    Quote Originally Posted by Kwest View Post
    I'm still wondering about Unix Network Programming, can I use the Unix Sockets in a windows environment using visual studio? I only ask because I have a book that was given to me on the Unix Sockets API. More than likely I would probably only be able to use WinSock though.
    Winsock is an implementation of the BSD sockets API that is not 100% compliant with the POSIX standard. So the Unix sockets and the Windows socket basically implement the same API but they are not identical. For example, Winsock requires a special initialization procedure that is not required on POSIX. That being said though, the APIs are still similar enough to write cross-platform code when using a few abstractions.

    Of course you would have already known all that if you read Beejs tutorial as I suggested a week ago

  9. #9
    Join Date
    Mar 2009
    Location
    Bellevue, WA
    Posts
    803
    I am going to be reading his tutorial within the next couple of days I got sidetracked Thanks ComicSansMS you're always very helpful.
    " Imagination is the preview of life's coming attractions " - Albert Einstein
    " If you can't explain it simply, you don't understand it well enough." - Albert Einstein

    My Website: http://www.gamedevlounge.com/

    If any post is informative please provide positive feedback by clicking the star below.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •