This topic describes how to use a Python IDE to integrate a GameShield SDK into Windows. It uses PyCharm as an example.

Prerequisites

  • You can obtain an SDK and AccessKey pair for Windows from the GameShield console. For more information, see Obtain an SDK package and AccessKey pair.
  • You can obtain the following information from the GameShield console.
    • GroupName: indicates a node group ID. Log on to the GameShield console, open the game management page, and view the target node group ID on the Basic Settings tab.Basic settings and a node group ID
    • Protection Target ID. Log on to the GameShield console, open the Games page, and view a protection target ID on the Protection Target Settings tab.Protection target settings and a protection target ID

Procedure

  1. Open a Python editor. The following uses PyCharm as an example.
  2. Create a 64-bit project.
  3. Copy the YunCeng-WINDOWS.dll file from the Windows SDK to the directory where the project resides.YunCeng-WINDOWS.dll
  4. Add the following statement to the code to load the YunCeng-WINDOWS.dll file.
    g_Dll = cdll.LoadLibrary("YunCeng-WINDOWS.dll")  
  5. Use the following code to check whether you can retrieve the IP address of a protection target.
    Init_result = g_Dll.YunCeng_InitEx(access_key,token)//Initialize the Windows SDK.
    #Return value
    ip_len=18
    ip = create_string_buffer('/0'*ip_len)
    port_len=18
    port = create_string_buffer('/0'*port_len)
    ret=g_Dll.YunCeng_GetProxyTcpByDomain("Player ID","GroupName","Protection target ID","Port for the protection target", ip, ip_len, port,port_len);
    if  ret == 0 ://A return value of 0 for the ret parameter indicates a success retrieval.