Programming Tips - Which library should I link my Winsock program to?

Date: 2013jan20 OS: Windows Q. Which library should I link my Winsock program to? A. These are the choices:
winsock.lib wsock32.lib ws2_32.lib
In my experience ws2_32.lib seems to be work on the largest number of machines... from different versions of Windows, etc. And to include winsock2, put this in your stdafx.h:
// Lean and mean avoids winsock.h which conflicts with winsock2 #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h>