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
Sockets in (Visual) C++
Moderator: Coders of Rage
- Netwatcher
- Chaos Rift Junior
- Posts: 378
- Joined: Sun Jun 07, 2009 2:49 am
- Current Project: The Awesome Game (Actual title)
- Favorite Gaming Platforms: Cabbage, Ground beef
- Programming Language of Choice: C++
- Location: Rehovot, Israel
Re: Sockets in (Visual) C++
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
http://www.madwizard.org/programming/tutorials/netcpp/
and dude, the Wizard in the pic... it's... YOU!!!! OMGOMGOMGOMGZZZZ!!!!555threethreethree
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
- captjack
- Chaos Rift Cool Newbie
- Posts: 50
- Joined: Fri Sep 18, 2009 4:23 pm
- Current Project: engine framework
- Favorite Gaming Platforms: PC, XBox 360, PS3
- Programming Language of Choice: C, C++
- Location: Northern Virginia
Re: Sockets in (Visual) C++
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.
My avatar is pretty cool. I can take no credit for him though. I got him from Tux Factory.
- Netwatcher
- Chaos Rift Junior
- Posts: 378
- Joined: Sun Jun 07, 2009 2:49 am
- Current Project: The Awesome Game (Actual title)
- Favorite Gaming Platforms: Cabbage, Ground beef
- Programming Language of Choice: C++
- Location: Rehovot, Israel
Re: Sockets in (Visual) C++
I meant the picture of the wizard in the website itself.(the link I sent you)
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
- captjack
- Chaos Rift Cool Newbie
- Posts: 50
- Joined: Fri Sep 18, 2009 4:23 pm
- Current Project: engine framework
- Favorite Gaming Platforms: PC, XBox 360, PS3
- Programming Language of Choice: C, C++
- Location: Northern Virginia
Re: Sockets in (Visual) C++
DOH! I even followed the link and saw that wiz... I must have been tired - didn't even register.Netwatcher wrote:I meant the picture of the wizard in the website itself.(the link I sent you)
-capt jack
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Sockets in (Visual) C++
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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.