NSPCleanup function

The NSPCleanup function terminates the use of a particular Windows Sockets namespace service provider.


int WSAAPI NSPCleanup(
  _In_ LPGUID lpProviderId


lpProviderId [in]

A pointer to the GUID of the namespace provider to be terminated.

Return value

If no error occurs, NSPCleanup returns a value of NO_ERROR (zero). Otherwise, SOCKET_ERROR (–1) is returned and the provider must set the appropriate error code using WSASetLastError.

Error codeMeaning

There is not enough memory available to perform this operation.


The lpProviderId parameter does not specify a valid provider.


The operation is not supported. This error is returned if the namespace provider does not implement this function.



The NSPCleanup function is called when an application is finished using a Windows Sockets namespace service provider. The NSPCleanup function deregisters a particular namespace provider and allows the transport service provider to free any of the namespace provider's allocated resources.

The NSPStartup function must be called successfully before using any namespace providers. It is permissible to make more than one NSPStartup call. However, for each NSPStartup call, a corresponding NSPCleanup call must also be issued. Only the final NSPCleanup for the service provider does the actual cleanup; the preceding calls decrement an internal reference count in the service provider.

This function should not return until the namespace service provider DLL can be unloaded from memory.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]



See also