Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Socket programing in C++

Status
Not open for further replies.

cRazysTuf

Programmer
Jun 18, 2003
6
US
Hi,
i have been woundering how one can do socket programing in C++.
i know there are alot of c tutorials out there but how can this be done in c++?
Thanks,
jeff
 
There's no standard library for C++ socket programming. There's lots of non-standard ones out there, though. Just do a Google search. I can't recommend any personally.

Boost ( is working on one, but they aren't done yet, so it's not in any of the releases. When they get done with it, though, it'll probably be pretty good, and a likely candidate for an addition to the new C++ Standard.
 
Do you really need one? At most, the library will just save you the bother of putting the SOCKET in a global variable. You could always write a class wrapper for it, which shouldn't take more than 15 minutes.

The constructor will do the socket call. The destructor will be the close. Then the rest are just member functions using the object handle instead of providing the socket to the call. Don't really see what you'd gain by putting them into a class.
 
well personly im a n00b in c++ so i dont know about doing that
 
I don't believe that socket development is an appropriate subject for C/C++ beginners.

"But, that's just my opinion... I could be wrong."

-pete
 
your right its not but..
ya gota start some where.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top