Advertisement

05.25.2005 at 06:32PM PDT, ID: 21437114
[x]
Attachment Details

Why does WinSock 2.0 send()  fail ?

Asked by hansw77041 in C++ Programming Language

Tags: 10038, winsock, wsagetlasterror, send

Why does WinSock 2.0 send() function think  the Socket passed to it is not a socket ?


 int ret = send(Socket, buf, 1, 0);

  if ( SOCKET_ERROR == nRet )  // ret is  SOCKET_ERROR
  {
       DWORD dwError =  WSAGetLastError();  // error is 10038 Not a socket.
  }


If the error is ignored the data is sent anyway, so how can it not be a socket !

Somwhere at the start of my code

    ULONG      ulRetCode = 0;
    WSADATA    WSAData = {0};

      if ( 0 != ( ulRetCode = WSAStartup(MAKEWORD(2, 2), &WSAData)))
      {
            return ulRetCode;
      }
      
      return ulRetCode;  returns here OK everytime.

Socket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);

Receiving data from the bluetooth device works just fine.

My code is non-blocking. In an attempt nail down this send() problem I also made a project that uses blocking calls.

Both cases send() thinks the socket is not a socket...  and if the code ignores the eror it works just fine.

I also tried WSASend() non-overlapped and it does the same thing...

Is there known problem with send() ?









Start Free Trial
 
 
[+][-]05.25.2005 at 06:37PM PDT, ID: 14082644

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 07:58PM PDT, ID: 14082878

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 08:46PM PDT, ID: 14083113

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 09:01PM PDT, ID: 14083159

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 09:25PM PDT, ID: 14083236

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 09:31PM PDT, ID: 14083265

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2005 at 09:38PM PDT, ID: 14083286

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.26.2005 at 07:07AM PDT, ID: 14086062

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C++ Programming Language
Tags: 10038, winsock, wsagetlasterror, send
Sign Up Now!
Solution Provided By: hansw77041
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.26.2005 at 06:29PM PDT, ID: 14091508

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.26.2005 at 09:07PM PDT, ID: 14091950

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.26.2005 at 11:38PM PDT, ID: 14092278

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.26.2005 at 11:51PM PDT, ID: 14092313

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.27.2005 at 06:04AM PDT, ID: 14094252

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.27.2005 at 07:51AM PDT, ID: 14095317

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2005 at 10:03PM PDT, ID: 14106619

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.31.2005 at 03:21AM PDT, ID: 14111850

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32