1。WSock32.Lib、WS2_32.Lib、MsWSock.Lib ?
   为什么没有 winsock.lib 却有 winsock.dll ?
2。WinSock.h、WinSock2.h、MSWSock.h ?这些 .h 文件和 .lib 文件有什么对应关系?

解决方案 »

  1.   

    Winsock Headers and Libraries
    As mentioned previously, Winsock is available in two major versions—Winsock 1 and Winsock 2—on all Windows platforms except Windows CE (Windows CE has only Winsock 1). When developing new applications you should target the Winsock 2 specification by including WINSOCK2.H in your application. For compatibility with older Winsock applications and when developing on Windows CE platforms, WINSOCK.H is available. There is also an additional header file: MSWSOCK.H, which targets Microsoft-specific programming extensions that are normally used for developing high performance Winsock applications, which will be described in Chapter 6.When compiling your application with WINSOCK2.H, you should link with WS2_32.LIB library. When using WINSOCK.H (as on Windows CE) you should use WSOCK32.LIB. If you use extension APIs from MSWSOCK.H, you must also link with MSWSOCK.DLL. Once you have included the necessary header files and link environment, you are ready to begin coding your application, which requires initializing Winsock
      

  2.   

    winsock 有两个不同的版本,第一版很old了,win95时代的,win2000后推崇第二版winsock 2,
    出了主板本号外,还有子版本号,这些功能上有差别,winsock2 支持原始套接字编程,MFC 还封装了winsock,使用WINSOCK.h 要用到WSOCK32.LIB,
    还有一些扩展api功能,需要MSWSOCK.h MSWSOCK.DLL
    现在winsock.h winsock2.h 都用ws2_32.lib;