WPUOpenCurrentThread function (ws2spi.h)

The WPUOpenCurrentThread function opens a handle to the current thread that can be used with overlapped functions in a layered service provider. This is intended to be used by layered service providers that wish to initiate overlapped I/O from nonapplication threads.

Syntax

int WPUOpenCurrentThread(
  [out] LPWSATHREADID lpThreadId,
  [out] LPINT         lpErrno
);

Parameters

[out] lpThreadId

Pointer to a WSATHREADID structure that can then be passed to an overlapped function.

[out] lpErrno

Pointer to the error code.

Return value

If no error occurs, WPUOpenCurrentThread returns the zero. Otherwise, it returns SOCKET_ERROR, and a specific error code is available in lpErrno.

Error code Meaning
WSANOTINITIALISED
A successful WSPStartup call must occur before using this function.
 
 

Remarks

The WPUOpenCurrentThread function provides a pointer to a WSATHREADID structure that can then be passed to an overlapped function such as LPWSPSend or LPWSPRecv. Layered service providers using a private thread in one of the upper layers will use WPUOpenCurrentThread to pass a WSATHREADID pointer to the lower layer that is administering overlapped functions.

Overlapped functions such as LPWSPSend and LPWSPRecv can then be used in the same way as a regular service provider.

Every call to WPUOpenCurrentThread must have a corresponding call to WPUCloseThread.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ws2spi.h

See also

WPUCloseThread

LPWSPRecv

LPWSPSend