you initialize SOCKADDR incorrectly:
strcpy_s(address.sa_data, "8.8.8.8"); - this is mistake.
in fact, SOCKADDR is only the owner of the place
Winsock functions using sockaddr are not strictly interpreted as pointers to the sockaddr structure. The structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is an address family and the total size of the memory buffer in bytes is namelen.
and here
To really fill in the values ββfor each part of the address, you use the SOCKADDR_IN Data Structure, which is a format specifically for this address. SOCKADDR and SOCKADDR_IN data structures are the same size. You simply use to switch between the two types of structure.
in your case you need to use SOCKADDR_IN
SOCKADDR_IN sa = { AF_INET }; sa.sin_addr.s_addr = inet_addr("8.8.8.8"); if (!QOSStartTrackingClient(QoSHandle, (SOCKADDR*)&sa, 0)) cout << GetLastError();
Rbmm
source share