DOCUMENT:Q155738 09-AUG-2001 [winnt] TITLE :Application Coding Error Results in Error 10038 (WSAENOTSOCK) PRODUCT :Microsoft Windows NT PROD/VER::3.5,3.51,4.0 OPER/SYS: KEYWORDS:kbnetwork kbAPI kbSDKPlatform kbWinsock kbGrpDSNet ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows NT Workstation versions 3.5, 3.51, 4.0 - Microsoft Windows NT Server versions 3.5, 3.51, 4.0 ------------------------------------------------------------------------------- SYMPTOMS ======== A Windows sockets application may return error 10038 (WSAENOTSOCK) in response to various socket calls. CAUSE ===== The Windows NT error "OBJECT_TYPE_MISMATCH" is mapped to Windows Sockets error "WSAENOTSOCK" by the Microsoft Winsock implementation. One possible cause of "OBJECT_TYPE_MISMATCH" error is an application written in such a manner as to close a given handle more than once. Errors are more likely to occur on multiprocessor computers. Application developers programming with the Win32 API set are instructed to be careful to close all of their handles when they are finished with them. However, if an application is written and linked with C runtime libraries, some of the C runtime code automatically cleans up resources such as handles to a thread. If the application developer closes a thread handle specifically, then calls _endthread() to terminate the thread, the _endthread routine also attempts to close the same handle. If the handle has been re-used at that point (by another thread), it will become an invalid thread and is likely to cause errors such as "INVALID_HANDLE" or "OBJECT_TYPE_MISMATCH." RESOLUTION ========== Consult with the application vendor to determine whether there is a possibility of the same handle being closed twice. Additional query words: socket select 10038 wsaenotsock ====================================================================== Keywords : kbnetwork kbAPI kbSDKPlatform kbWinsock kbGrpDSNet Technology : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT351search kbWinNT350search kbWinNT400search kbWinNTW350 kbWinNTW350search kbWinNTW351search kbWinNTW351 kbWinNTSsearch kbWinNTS400search kbWinNTS400 kbWinNTS351 kbWinNTS350 kbWinNTS351search kbWinNTS350search Version : :3.5,3.51,4.0 ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.