Windows* Sockets 2 Application Programming Interface An Interface for Transparent Network Programming Under Microsoft Windowstm revision 2 August 7, 1997



Download 1.64 Mb.
Page41/49
Date31.07.2017
Size1.64 Mb.
#24975
1   ...   37   38   39   40   41   42   43   44   ...   49

124 WSAUnhookBlockingHook()


Description Restore the default blocking hook function. WSAUnhookBlockingHook() is only available for WinSock 1.1 apps (that is, if at least one thread within the process negotiates version 1.0 or 1.1 at WSAStartup()).

Important Note: This function is for backwards compatibility with WinSock 1.1 and is not considered part of the WinSock 2 specification. WinSock 2 applications should not use this function.

#include
int WSAAPI WSAUnhookBlockingHook ( void );
Remarks This function removes any previous blocking hook that has been installed and reinstalls the default blocking mechanism.
WSAUnhookBlockingHook() will always install the default mechanism, not the previous mechanism. If an application wish to nest blocking hooks - i.e. to establish a temporary blocking hook function and then revert to the previous mechanism (whether the default or one established by an earlier WSASetBlockingHook()) - it must save and restore the value returned by WSASetBlockingHook(); it cannot use WSAUnhookBlockingHook().
In multithreaded versions of Windows such as Windows NT, there is no default blocking hook. Calling WSAUnhookBlockingHook() disables any blocking hook installed by the application and any blocking calls made block the thread which made the call.
Return Value The return value is 0 if the operation was successful. Otherwise the value SOCKET_ERROR is returned, and a specific error number may be retrieved by calling WSAGetLastError().
Error Codes WSANOTINITIALISED A successful WSAStartup() must occur before using this API.
WSAEINPROGRESS A blocking Windows Sockets operation is in progress.
WSAEOPNOTSUPP The caller is not a WinSock 1.0 or 1.1 client.
See Also WSASetBlockingHook(), WSAIsBlocking(), WSACancelBlockingCall()

125 WSAWaitForMultipleEvents()


Description Returns either when any one or all of the specified event objects are in the signaled state, or when the timeout interval expires.
#include
DWORD WSAAPI
WSAWaitForMultipleEvents(
IN DWORD
cEvents,
IN const WSAEVENT FAR *
lphEvents,
IN BOOL
fWaitAll,
IN DWORD
dwTimeout,
IN BOOL
fAlertable
);
cEvents Specifies the number of event object handles in the array pointed to by lphEvents. The maximum number of event object handles is WSA_MAXIMUM_WAIT_EVENTS. One or more events must be specified.
lphEvents Points to an array of event object handles.
fWaitAll Specifies the wait type. If TRUE, the function returns when all event objects in the lphEvents array are signaled at the same time. If FALSE, the function returns when any one of the event objects is signaled. In the latter case, the return value indicates the event object whose state caused the function to return.
dwTimeout Specifies the time-out interval, in milliseconds. The function returns if the interval expires, even if conditions specified by the fWaitAll parameter are not satisfied. If dwTimeout is zero, the function tests the state of the specified event objects and returns immediately. If dwTimeout is WSA_INFINITE, the function's time-out interval never expires.
fAlertable Specifies whether the function returns when the system queues an I/O completion routine for execution by the calling thread. If TRUE, the completion routine is executed and the function returns. If FALSE, the completion routine is not executed when the function returns.
Remarks WSAWaitForMultipleEvents() returns either when any one or when all of the specified objects are in the signaled state, or when the time-out interval elapses. This function is also used to perform an alertable wait by setting the parameter fAltertable to be TRUE. This enables the function to return when the system queues an I/O completion routine to be executed by the calling thread.
When fWaitAll is TRUE, the function’s wait condition is satisfied only when the state of all objects is signaled at the same time. The function does not modify the state of the specified objects until all objects are simultaneously signaled.
Applications that simply need to enter an alertable wait state without waiting for any event objects to be signaled should use the Win32 SleepEx() function.


Return Value If the function succeeds, the return value indicates the event object that caused the function to return.
If the function fails, the return value is WSA_WAIT_FAILED. To get extended error information, call WSAGetLastError().
The return value upon success is one of the following values:
Value Meaning
WSA_WAIT_EVENT_0 to (WSA_WAIT_EVENT_0 + cEvents - 1)

If fWaitAll is TRUE, the return value indicates that the state of all specified event objects is signaled. If fWaitAll is FALSE, the return value minus WSA_WAIT_EVENT_0 indicates the lphEvents array index of the object that satisfied the wait.


WAIT_IO_COMPLETION

One or more I/O completion routines are queued for execution.


WSA_WAIT_TIMEOUT

The time-out interval elapsed and the conditions specified by the fWaitAll parameter are not satisfied.


Error Codes WSANOTINITIALISED A successful WSAStartup() must occur before using this API.
WSAENETDOWN The network subsystem has failed.
WSAEINPROGRESS A blocking WinSock 1.1 call is in progress, or the service provider is still processing a callback function.
WSA_NOT_ENOUGH_MEMORY Not enough free memory available to complete the operation.
WSA_INVALID_HANDLE One or more of the values in the lphEvents array is not a valid event object handle.
WSA_INVALID_PARAMETER The cEvents parameter does not contain a valid handle count.
See Also WSACreateEvent(), WSACloseEvent().

Download 1.64 Mb.

Share with your friends:
1   ...   37   38   39   40   41   42   43   44   ...   49




The database is protected by copyright ©ininet.org 2024
send message

    Main page