views:

1037

answers:

4

I'm writing a threaded cross-platform application (Linux/Windows) using SDL and OpenGL, and to do networking I was considering SDL Net2 because it sits on top of SDL_Net.

However, I've never done networking in C/C++ before, so I'm unfamiliar with any available cross-platform technologies. Is there anyone with experience with SDL_Net or Net2 who would suggest a different library?

+6  A: 

boost::asio is your friend. It is cross platform async io library. Good for network. With a lot of samples on the boost site. http://www.boost.org/

Mykola Golubyev
+1  A: 

Try Boost.Asio perhaps.

Augusto Radtke
+1  A: 

There are a bunch of frameworks out there (e.g., Poco, ACE). It depends on what you are looking for. If you want to create raw sockets at the OS layer and send byte streams across them, then I would go with Boost.Asio as suggested by everyone else. If you are looking for sending XML documents over HTTP or something like that, then investigate some of the other alternatives.

D.Shawley
A: 

As others already said, boost::asio is certainly the good choice.

Now that said, that's really to make "raw" networking.

IF you're making a video game, or network-performance-like-video-game software, maybe a more high-level and optimized for this case library like the heavily recommanded RakNet library would be a better choice. Another alternative in this same case, if you want lower level UDP based library, ENet might suit your needs.

Klaim