SOCKET目前有哪些版本呢?如何获取版本号?如何更新?各版本有什么不同吗?

解决方案 »

  1.   

    初始化时WSAStartup的功能之一就是协商版本。
      

  2.   

    This negotiation allows both a Ws2_32.dll and a Windows Sockets application to support a range of Windows Sockets versions. An application can use Ws2_32.dll if there is any overlap in the version ranges. The following table shows how WSAStartup works with different applications and Ws2_32.dll versions.App versions DLL versions wVersion
    requested wVersion wHigh
    version End result  
    1.1 1.1 1.1 1.1 1.1 use 1.1 
    1.0 1.1 1.0 1.1 1.0 1.0 use 1.0  
    1.0 1.0 1.1 1.0 1.0 1.1 use 1.0 
    1.1 1.0 1.1 1.1 1.1 1.1 use 1.1 
    1.1 1.0 1.1 1.0 1.0 Application fails 
    1.0 1.1 1.0 --- --- WSAVERNOT
    SUPPORTED 
    1.0 1.1 1.0 1.1 1.1 1.1 1.1 use 1.1 
    1.1 2.0 1.1 2.0 1.1 1.1 use 1.1 
    2.0 2.0 2.0 2.0 2.0 use 2.0 
      

  3.   

    因为小弟我最近在做SPI的开发,它对WInSocket的版本要求是2.0,所以有以上问题,请各位大侠不吝赐教
      

  4.   

    WORD wVersionRequested;
    WSADATA wsaData;
    int err;
     
    wVersionRequested = MAKEWORD( 1, 1 );
     
    err = WSAStartup( wVersionRequested, &wsaData );
    if ( err != 0 ) {
     /* Tell the user that we could not find a usable */
     /* WinSock DLL.   */
     return;
    }
     
    /* Confirm that the WinSock DLL supports 1.1.*/
    /* Note that if the DLL supports versions greater */
    /* than 1.1 in addition to 1.1, it will still return */
    /* 1.1 in wVersion since that is the version we */
    /* requested.   */
     
    if ( LOBYTE( wsaData.wVersion ) != 1 ||
     HIBYTE( wsaData.wVersion ) != 1 ) {
     /* Tell the user that we could not find a usable */
     /* WinSock DLL.   */
     WSACleanup( );
     return; 
    }
     
    /* The WinSock DLL is acceptable. Proceed. */
      

  5.   

    可以WSAStartup启动时,指定版本,然后看指定是否成功