This topic describes how to use a C++ compiler in Windows to integrate GameShield SDK for Windows.

Prerequisites

The SDK package and AccessKey for Windows is obtained from the GameShield console. The AccessKey is required when you set the appkey parameter. For more information, see Obtain an SDK package and AccessKey pair. Obtain the SDK package and AccessKey

Procedure

  1. Open a C++ compiler in Windows.
  2. Create a project of the Console App type. In this example, the project is named yxd_windows_sdk_test. Create a project
  3. Add dependencies to the libs directory.
    1. Create a directory named libs in the project directory.
    2. Copy the YunCeng-WINDOWS.lib file from the Windows SDK package to the libs directory.
    3. Open the Property page of the project, choose Linker > General, and then add ./libs as an additional library directory.
    4. Choose Linker > Input and add YunCeng.WINDOWS.lib as an additional dependency.
  4. Add header files and write test code.
    char appkey[] = "testgroupid";     
    eAlSdkRet ret = YunCeng_InitEx(appkey, "token");       
    if (ret != cAlSdkOK) {              
            printf("init sdk failed.\n");         
            return -1;    
       }
  5. Move the YunCeng-WINDOWS.dll file to the directory where the project executable file resides. In this example, the executable file is yxd_windows_sdk_test.exe. YunCeng-WINDOWS.dll
  6. Check whether you can obtain the IP address of a game client.
    /*
     ret = YunCeng_GetProxyTcpByIp("token","groupId", "1.1.1.1","80", ip,ip_len,  port,port_len);  */
    ret= YunCeng_GetProxyTcpByDomain("token","groupId", "www.dst.com","80", ip, ip_len, port,port_len);
    if (ret != cAlSdkOK) {
        printf("get next ip failed. \n");
       } else {
        printf("get next ip success. %s %s\n", ip, port);
       }