CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Socket error 10038

    Hi,
    I have the following function which is called by several other programs.

    I am getting the socket error 10038, which means socket operation on a non socket. How do I go about troubleshooting?
    How do I know which thread is calling this function?
    Code:
    int CSocHandler::sendAll(char * cSendBuffer, int length) {
    if (length <=0) {
    return 0;
    }

    int iTotalBytesSent = 0;
    do {
    int iBytesSent = ::send( sock, &cSendBuffer[iTotalBytesSent], length-iTotalBytesSent , 0);
    Yield();
    if (iBytesSent <= 0) {
    int iErrorCode = WSAGetLastError();
    cout << "\nSocket error in CSocHandler::sendAll : " << iErrorCode;
    cout << " - Buffer: " << cSendBuffer << endl;
    break;
    }
    iTotalBytesSent +=iBytesSent;
    } while (iTotalBytesSent < length);

    return iTotalBytesSent;
    }

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Socket error 10038

    Read MSDN
    WSAENOTSOCK
    10038
    Socket operation on nonsocket.
    An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured