WSAProviderConfigChange

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

Syntax

INT WSAProviderConfigChange(
         LPHANDLE lpNotificationHandle,
         LPWSAOVERLAPPED lpOverlapped,
         LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
)  

Parameters

lpNotificationHandle
Type: LPHANDLE 

[in, out] 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.

lpOverlapped
Type: LPWSAOVERLAPPED 

[in, out, optional] Pointer to a WSAOVERLAPPED structure.

lpCompletionRoutine
Type: LPWSAOVERLAPPED_COMPLETION_ROUTINE 

[in, optional] Pointer to the completion routine called when the provider change notification is received.

Return value

Type: INT 

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.

Return codes
Return code Description
WSANOTINITIALISED A successful WSAStartup call 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.

Remarks

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:

Requirements

Header: Declared in winsock2.h.

Library: Use ws2_32.lib.