WSAProviderConfigChange

The WSAProviderConfigChange function notifies the application when the provider configuration is changed.

int WSAAPI 
WSAProviderConfigChange(
  LPHANDLE lpNotificationHandle,
  LPWSAOVERLAPPED lpOverlapped,
  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);

Parameters

lpNotificationHandle
(in/out) A pointer to notification handle; if the notification handle is set to NULL (the handle value not the pointer itself), this function returns notification handle in the location pointed by lpNotificationHandle.
lpOverlapped
(in) A pointer to a WSAOVERLAPPED structure.
lpCompletionRoutine
(in) A pointer to the completion routine called when the provider change notification is received.

Remarks

The WSAProviderConfigChange function notifies the application of provider (both transport and name space) installation or removal in Win32 operating environments that support such configuration change without requiring a restart. When called for the first time (lpNotificationHandle parameter points to NULL handle), this function completes immediately and returns notification handle in the location pointed by lpNotificationHandle that can be used in subsequent calls to receive notifications of provider installation and removal. The second and any subsequent calls only complete when provider information changes since the time the call was made It is expected (but not required) that that application uses overlapped I/O on second and subsequent calls to WSAProviderConfigChange, in which case the call will return immediately and application will be notified of provider configuration changes using the completion mechanism chosen through specified overlapped completion parameters.

Notification handle returned by WSAProviderConfigChange is like any regular operating system handle that should be closed (when no longer needed) using Win32 CloseHandle call.

The following sequence of actions can be used to guarantee that application always has current protocol configuration information:

Return Values

If no error occurs the WSAProviderConfigChange returns 0. Otherwise, a value of SOCKET_ERROR is returned and a specific error code may be retrieved by calling WSAGetLastError. The error code WSA_IO_PENDING indicates that the overlapped operation has been successfully initiated and that completion (and thus change event) will be indicated at a later time

Error Codes

WSANOTINITIALISED A successful WSAStartup must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSA_NOT_ENOUGH
_MEMORY
Not enough free memory available to complete the operation.
WSA_INVALID_HANDLE Value pointed by lpNotificationHandle parameter is not a valid notification handle.
WSAEOPNOTSUPP Current operating system environment does not support provider installation or removal without restart.

QuickInfo

  Windows NT: Yes
  Windows: Yes
  Windows CE: Unsupported.
  Header: Declared in winsock2.h.
  Import Library: Link with ws_32.lib.

See Also

WSAEnumProtocols, WSAEnumNameSpaceProviders