Page 1 of 1

Sockets in (Visual) C++

Posted: Wed Oct 07, 2009 2:05 pm
by captjack
Hey everyone,

I have what seems like a really, really dumb question. I'm trying to do some socket programming in C++ using Visual Studio. Despite some online references about WinSock, none of the code I'm attempting works. I'm talking real simple stuff like binding a socket, nothing about sending/receiving, just getting the damn thing open.

I'm from a UNIX background and have done some pretty decent work using native Berkeley sockets, but this was in C and the socket library is well documented.

Do I need to write some C wrappers around anything to get sockets working in C++? There are probably some third party libs out there (boost perhaps), but I'd like to keep this as minimalist as possible without using too many outside libraries. So far the only external libraries I've included in my project are OpenGL and DirectX. Ideally I'd like to have some sort of socket class to do networking related tasks for the game protocols between client and server, and keep it as streamlined and manageable as possible.

A point in the right direction would be most helpful.

-capt jack

Re: Sockets in (Visual) C++

Posted: Wed Oct 07, 2009 2:25 pm
by Netwatcher
I learned my WinSock from this site(well most of it, I had to look at actual code to figure out some other stuff)
http://www.madwizard.org/programming/tutorials/netcpp/

and dude, the Wizard in the pic... it's... YOU!!!! OMGOMGOMGOMGZZZZ!!!!555threethreethree

Re: Sockets in (Visual) C++

Posted: Wed Oct 07, 2009 2:52 pm
by captjack
Sweet. That site looks excellent. I'll spend some time over there. Thanks for that.

My avatar is pretty cool. I can take no credit for him though. I got him from Tux Factory.

Re: Sockets in (Visual) C++

Posted: Wed Oct 07, 2009 5:05 pm
by Netwatcher
I meant the picture of the wizard in the website itself.(the link I sent you)
:roll:

Re: Sockets in (Visual) C++

Posted: Thu Oct 08, 2009 10:48 am
by captjack
Netwatcher wrote:I meant the picture of the wizard in the website itself.(the link I sent you)
DOH! I even followed the link and saw that wiz... I must have been tired - didn't even register.

-capt jack

Re: Sockets in (Visual) C++

Posted: Thu Oct 08, 2009 10:58 am
by MarauderIIC
When I used Beej's Guide, I didn't have any real problem following the tuts. Someone's mentioned something about "not winsock2" since then.