Alex Rivera | Logout

Resources to learn Networking with C++

Asked 2010-10-02T18:52:35.343
38

I'm a newcomer to using C++ but have got a general Idea of its syntax and usability. I want to learn how to communicate over networks through C++ programming though but I can't seem to find any tutorials for C++ specifically. Does anyone know any good resources to learn about networking with C++ or what I should start with?

Edit
Report

1 Answer

10

I'm sure a bunch of C++ people who despise the C way of doing things will hate me for this, but the classical approach is to use the Berkeley socket APIs (so-called because they have their origins in BSD). If you're targeting Windows, the "largely-source-compatible, inspired-by-Unix" APIs are called Winsock. I'd say do a web search for socket tutorial and you will probably get some useful information. With a little care and maybe an #ifdef or two, it's not so hard to create code which works on Linux, BSD, Mac (which provide BSD sockets) and Windows (with Winsock) using what's common between these two interfaces.

For the more C++ inclined, less C-style people, or those who don't like to code against OS APIs, I'm sure there are C++ libraries out there that provide wrappers and abstractions for these same concepts. Since Boost seems to be pretty popular, I'd say see what they have.

answered 2010-10-02T19:00:42.277

Your Answer