tags:

views:

266

answers:

7

Hi to all,

I have write a game on OpenGl, and want to make it a multiplayer game. I'm working on Windows, but I'm actually a C#-programmer. Socket programming goes too easy at C#, but at c++ I can not solve it :(

Which library should I use? winsock and winsock2 libraries are too complicated. Is there any library easy to use like in C# System.Net.Sockets ?

Kind Regards.

+1  A: 

I haven't tried any of these. How about SDL_net or Qt?

Read about QSocket in the qt documentation.

torbjoernwh
+4  A: 

Beej's Guide to Network Programming is recommended in a number of SO replies, for example binding-a-socket-to-port-80-in-ansi-c. Try going over the examples, and maybe you'll find that it's not "too complicated". Windows winsock is highly compatible with the standard socket library. The tutorial contains instructions for programming sockets under Windows.

gimel
Agreed - it's a bit naive for Cmptrbto assume that existing libraries are too complicated when it appears they haven't done much investigation.
MBillock
+1  A: 

You can take a look a the networking sections of the Poco libraries. They aren't going to necessarily be like C# but they are OOP oriented and insulate you as much as possible from the details of network programming. They are also cross-platform is that is an issue.

[Obligatory note that you should probably expose yourself to said details at some point.]

Duck
+4  A: 

Have a look at the ACE framework. It exists for quite some time.

stefaanv
I've used ACE framework and its quite useful. Use the link the previous poster gave. Easy to absorb if you know what you want to get out of it.
Gentoo
It's too big for what it needs to do in games.
Chaoz
The OP can decide this after having a look. I admit it is pretty big.
stefaanv
zooropa
A: 

You should look into Raknet if you're intrested in Networking for games; or Winsock/BSD sockets if you really want to learn everything under the hood!

Chaoz
+2  A: 

The Boost.Asio library is also quite good.

Void
A: 

If you're looking for a simple wrapper to make Socket programming nicely object-oriented, you might check out the sockets wrapper layer I wrote as part of my cross-platform messaging library. It would be pretty straightforward to rip that code out and re-use it. You might even be interested in the rest of the library as well.

Jeremy Friesner