When to Use Synchronous Socket Handles & Blocking HooksLast reviewed: September 29, 1995Article ID: Q131623 |
The information in this article applies to:
SUMMARYBy default, all socket handles are opened as overlapped handles so that asynchronous I/O can be performed on them. However, in many situations you may find it preferable to have nonoverlapped (synchronous) socket handles. For example, only nonoverlapped handles can be used with the C run-time libraries or used as standard I/O handles for a process. Under Windows NT and Windows 95, the SO_OPENTYPE socket option allows an application to open non-overlapped socket handles.
MORE INFORMATIONThere are some Windows Sockets features that you cannot use with synchronous sockets. Here is an extract from the Winsock Help file:
The WSAAsyncSelect call cannot be used with synchronous sockets and will fail with the error WSAEINVAL. It is also not possible to set the SO_SNDTIMEO and SO_RCVTIMEO socket options on synchronous sockets; setsockopt with these options on synchronous sockets fails with WSAEINVAL as well.Due to the non-preemptive nature of Windows version 3.1 and Windows for Workgroups version 3.11, the Winsock specification details a mechanism by which a Winsock application can "yield" processor time. For more information, please search for WSASetBlockingHook() in the Winsock Help file. NOTE: Use of a blocking hook is not recommended on a 32-bit platform. If a 32-bit application chooses to install a blocking hook, the blocking hook will be disabled if the application is run under Windows NT, but it will remain enabled if the application is run under Windows 95.
REFERENCESOnline winsock help file
|
Additional reference words: 3.10 3.50 3.51 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |