1

I have a problem in my C client, where I implemented a client gsoap program to invoke a web service.

Everything works fine on a Windows PC, but when I publish my code on a linux-based POS device, I receive the following error:

"setsockopt SO_SNDBUF failed in tcp_connect()"

Where should I start to debug this error, what could be the cause?

the errornum returned is 2

The code section that generates the error : (in stdsoap2.c)

 if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))){
    soap->errnum = soap_socket_errno(sk);
    soap_set_sender_error(soap, 
                          tcp_error(soap), 
                         "setsockopt SO_SNDBUF failed in tcp_connect()",
                          SOAP_TCP_ERROR);
    soap->fclosesocket(soap, sk);

#ifdef WITH_IPV6
    freeaddrinfo(ressave);
#endif
    return SOAP_INVALID_SOCKET;
  }
Jayan
  • 18,003
  • 15
  • 89
  • 143
Rabih harb
  • 1,372
  • 12
  • 11
  • Your title consists of an error message of your own invention. it is therefore futile as a title here. It is also futile as an error message. What's the 'errno'? When you get a system error, telling yourself your own message isn't helpful. Tell yourself the *system's* error. – user207421 Mar 31 '13 at 00:52
  • well it turned out to be very simple one!! i just had to build the c/c++ files using the binaries dedicated for linux.... gsoap(wsdl2h,soapcpp2) – Rabih harb Apr 08 '13 at 15:57

2 Answers2

0

How big is the len argument? It's possible that the value works on Windows, but is rejected by linux for some reason. Take a look at the actual values being submitted and see if they look reasonable.

You can also try reducing this down to a very small program that just sets up a socket and tries to replicate the call to setsockopt() and see if it still fails with the SO_SNDBUF size the main program is trying to use.

Randy Howard
  • 2,165
  • 16
  • 26
  • usually this variable is equal to soap_buf length=65535 bytes int len = SOAP_BUFLEN ; i ll to try to use smaller values. i tried a small program that test the setsockopt and getsockopt – Rabih harb Mar 29 '13 at 16:33
0

well it turned out to be very simple one!!

i just had to build the c/c++ files using the binaries dedicated for linux....

gsoap(wsdl2h,soapcpp2)

windows build uses winsock and linux build uses standard sockets and the sockets on the 2 systems are differentes!

thats why i was receiving the socket error.

hope this help others, getting this socket error msg..

Rabih harb
  • 1,372
  • 12
  • 11