Export (0) Print
Expand All
TRY
Expand Minimize

AfxSocketInit

Call this function in your CWinApp::InitInstance override to initialize Windows Sockets.

BOOL AfxSocketInit(
   WSADATA* lpwsaData = NULL 
);

Parameters

lpwsaData
A pointer to a WSADATA structure. If lpwsaData is not equal to NULL, then the address of the WSADATA structure is filled by the call to WSAStartup. This function also ensures that WSACleanup is called for you before the application terminates.

Return Value

Nonzero if the function is successful; otherwise 0.

Example

BOOL CMyApp::InitInstance()
{
   //Default Application Wizard code.
   if(!AfxSocketInit())
      AfxMessageBox("Failed to Initialize Sockets",MB_OK| MB_ICONSTOP);
   return CWinApp::InitInstance();
}

See Also

MFC Macros and Globals | CWinApp::InitInstance

Show:
© 2015 Microsoft