Skip to main content
Inspiring
December 19, 2007
Question

Visual Studio and Winsock vs. Winsock2

  • December 19, 2007
  • 2 replies
  • 1334 views
Hi Folks,

First off, I'm a Mac guy who is still relatively new to Visual Studio 2003 and 2005. I have a question that I hope is simple for someone with Visual Studio experience to answer...

I am working on a plug-in that uses sockets and I was trying to use Winsock2 instead of Winsock (I used Winsock2 in my stand-alone test application, and figured I would stick with it my plug-in). My problem is that in order to get winsock2.h to successfully load in my plug-in code (without a ton of warnings/errors), it appears that I need to load winsock2.h before windows.h. I'm not sure how to do this in plug-in code, and I am hoping someone could shed some light on this for me.

My use of sockets isn't all that complex, so maybe I'm OK with using plain old winsock. I'm just really curious how one would go about using winsock2.h in a plug-in. Should I use the WS2_32.lib with the winsock2.h header file? That seems like a bad idea, so I'm using wsock32.lib.

Any help will be greatly appreciated!!!

Cheers!

-- Jim
This topic has been closed for replies.

2 replies

Inspiring
December 20, 2007
Thanks Charles, I'll give it a try!

Cheers!

-- Jim
Known Participant
December 19, 2007
We use Winsock2 too, without problems. What we did was edit the Adobe file VCPlugInHeaders.h to look like this:

#if defined WINDOWS && defined _MSC_VER

// Include Winsock2.h first to stop Windows.h (via ShukHeaders.cp)
// including Winsock.h"
#include "Winsock2.h"
#include "ShukHeaders.cp"
#endif

See if that fixes it for you.

Regards,

Charles