getsockname() returns error 10038 (WSAENOTSOCK) on a duplicated socket (319952)



The information in this article applies to:

  • Microsoft Windows XP Professional
  • Microsoft Windows XP Home Edition
  • Microsoft Windows 2000

This article was previously published under Q319952

SYMPTOMS

When you call Getsockname() on a duplicated socket, the call may not succeed and you may receive error 10038 (WSAENOTSOCK).

This problem occurs when the following conditions exist:
  • If the socket handle is duplicated using DuplicateHandle().
  • The socket is bound and listening on the loopback address 127.0.0.1.
  • The network cable is unplugged.
  • Microsoft Proxy Client is installed.

RESOLUTION

To resolve the problem, use the WSADuplicateSocket() call to share a socket between processes.

Modification Type:MajorLast Reviewed:5/19/2005
Keywords:kbDSWNET2003Swept kbAPI kbfix kbnetwork kbprb kbWinsock KB319952