Platform SDK: Windows Sockets |
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.
INT WPUOpenCurrentThread ( LPWSATHREADID lpThreadId, LPINT lpErrno );
If no error occurs, WPUOpenCurrentThread returns the zero. Otherwise, it returns SOCKET_ERROR, and a specific error code is available in lpErrno.
The WPUOpenCurrentThread function provides a pointer to a WSATHREADID structure that can then be passed to an overlapped function such as WSPSend or WSPRecv. Layered service providers that use 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 WSPSend and WSPRecv can then be used in the same way as a regular service provider.
Every call to WPUOpenCurrentThread must have a corresponding call to WPUCloseThread.
Error code | Meaning |
---|---|
WSANOTINITIALISED | A successful WSPStartup call must occur before using this function. |
Version: Requires Windows Sockets 2.0.
Header: Declared in Ws2spi.h.