The WSAProviderConfigChange function notifies the application when the provider configuration is changed.
INT WSAAPI WSAProviderConfigChange( LPHANDLE lpNotificationHandle, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine );
Pointer to notification handle. If the notification handle is set to NULL (the handle value not the pointer itself), this function returns a notification handle in the location pointed to by lpNotificationHandle.
Pointer to a WSAOVERLAPPED structure.
Pointer to the completion routine called when the provider change notification is received.
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.
|A successful WSAStartup call must occur before using this function.|
|The network subsystem has failed.|
|Not enough free memory available to complete the operation.|
|Value pointed by lpNotificationHandle parameter is not a valid notification handle.|
|Current operating system environment does not support provider installation or removal without restart.|
The WSAProviderConfigChange function notifies the application of provider (both transport and namespace) installation or removal in Windows 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 the 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 Windows CloseHandle call.
The following sequence of actions can be used to guarantee that application always has current protocol configuration information:
- Call WSAProviderConfigChange
- Call WSAEnumProtocols and/or WSAEnumNameSpaceProviders
- Whenever WSAProviderConfigChange notifies application of provider configuration change (through blocking or overlapped I/O), the whole sequence of actions should be repeated.
|Minimum supported client||Windows 8.1, Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|