I want to use ConnectEx function on Windows7, with MSVC2010.
I am getting error C3861: 'ConnectEx': identifier not found
MSDN suggests the function should be declared in mswsock.h, however, when checking it, it's not defined there.
Any tips?
I want to use ConnectEx function on Windows7, with MSVC2010.
I am getting error C3861: 'ConnectEx': identifier not found
MSDN suggests the function should be declared in mswsock.h, however, when checking it, it's not defined there.
Any tips?
If you read further into the MSDN article for
ConnectEx()
you mentioned, it says:Unlike other Windows API functions,
ConnectEx()
must be loaded at runtime, as the header file doesn't actually contain a function declaration forConnectEx()
(it does have atypedef
for the function calledLPFN_CONNECTEX
) and the documentation doesn't specifically mention a specific library that you must link to in order for this to work (which is usually the case for other Windows API functions).Here's an example of how one could get this to work (error-checking omitted for exposition):