Questions about Winsock 2

210 views Asked by At
WSADATA wsaData;
SOCKET ConnectSocket = INVALID_SOCKET;
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);

WSADATA is info, but what info is it specifically?

WSAStartup is a function to initiate WS2_32.dll. What is the difference between initiating WS2_32.dll and SOCKET?

1

There are 1 answers

0
Remy Lebeau On

WSADATA is info, but what info is it specifically?

Please read the documentation, it tells you exactly what is in WSADATA and what it means:

WSAStartup function

WSADATA structure

WSAStartup is a function to initiate WS2_32.dll.

Correct.

What is the difference between initiating WS2_32.dll and SOCKET?

WS2_32.dll is the WinSock library itself. The SOCKET is a handle to a specific socket connection. The socket is allocated with the socket() or WSASocket() function, and released with the closesocket() function.