Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Okee on May 09, 2005, 05:38 PM

Title: Winsock classes?
Post by: Okee on May 09, 2005, 05:38 PM
Hey. My bot connects and stuff, but I was wondering - are there any classes out there or wrappers people have made that make the winsock portion of console C++ bots any cleaner? My code is real messy and I was going to try and make some sort of class or wrapper to make it a little easier - by why reinvent the wheel, eh? Just wondering if anyone has anything like this.
Title: Re: Winsock classes?
Post by: MyndFyre on May 09, 2005, 06:42 PM
If you're supporting ActiveX in your project, you may (or may not) be able to use the Microsoft Winsock OCX.
Title: Re: Winsock classes?
Post by: Mangix on May 20, 2005, 11:27 PM
http://www.cplusplus.com/src/

scroll down to windows programs and you will find a C++ Winsock wrapper.
Title: Re: Winsock classes?
Post by: OnlyMeat on May 21, 2005, 02:45 PM
Quote from: MyndFyre on May 09, 2005, 06:42 PM
If you're supporting ActiveX in your project, you may (or may not) be able to use the Microsoft Winsock OCX.

Apart from the fact people usually code in c/c++ to avoid costly COM marshaling, the Microsoft Winsock OCX requires a window handle for notifying the container of specific events. This guy is writing a console app, so that would be unsuitable.

Also, the fact that COM uses an apartment threading model causes major headaches for a multithreaded c/c++ app. Besides that, using/implementing COM interfaces in pure c/c++ is no trivial task.