0

What I want to understand is how it all works, including the following parts:

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 differenece between initiating WS2_32.dll and SOCKET?

2
Contributors
1
Reply
16
Views
2 Years
Discussion Span
Last Post by Kanoisa
0

Hi Wajed

To answer your questions:

"WSADATA is info, but what info is it specifically?"

For Windows API methods your first port of call will often be MSDN. Heres the MSDN on WSAStartup which explains the WSADATA struct.
MSDN: WSAStartup function

"What is the differenece between initiating WS2_32.dll and SOCKET?"

In windows to gain access to sockets support first you must initialise the sockets layer : winsock2 in your case. This done by loading the functions from the winsock dll.

Note: If you ever move to *nix based systems socket support does not require initilisation in this manner. Just include the relavent headers.

Then when you initialise a socket itself your setting up an actual socket to begin communications.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.