Ticket #101 (closed defect: worksforme)

Opened 7 years ago

Last modified 6 years ago

setsockopt(IP_ADD_MEMBERSHIP) fails for Windows CE

Reported by: Bill Jeffreys <wjeffreys@…> Owned by: elmex
Priority: blocker Milestone: 0.9
Component: core Version: 0.9
Keywords: Cc:


In the file ws-discovery.c the function wsd_bind_multicastudp() is called to create a multicast socket. It calls the function wsd_bind_udp() which calls soap_set_mode() to set the SOAP_IO_UDP flag so that a UDP socket is created and then calls soap_bind() (in the file stdsoap2.c) to create the socket.

In the soap_bind() function the SOAP_IO_UDP flag is checked to create a datagram socket. However, if the WITH_LEAN define is defined a stream socket is created instead. This causes the setsockopt(IP_ADD_MEMBERSHIP) call in wsd_bind_multicastudp() to fail with the error 10042 because the socket created is a stream socket NOT datagram.

When building for Windows CE, WITH_LEAN is defined in stdsoap2.h. This means that wsd_bind_multicastudp() always fails with the error 10042 because a stream socket is always created.

The calling sequence is illustrated below for clarity (hopefully):



soap_set_mode() soap_bind()

socket(AF_INET, SOCK_DGRAM, 0) always called for CE!!


I am using ws4d-gsoap 0.9 and gsoap 2.7.13. If you need more information or clarification please email me.


Change History

Changed 7 years ago by elmex

  • status changed from new to assigned
  • milestone set to 0.9

Hi Bill,

ws4d-gsoap requires WITH_LEAN to be disabled, because WITH_LEAN disables the SOAP-over-UDP-support in gsoap. I don't know why the wince support enables WITH_LEAN by default in gsoap. Maybe the SOAP-over-UDP support for wince is not yet implemented in gsoap, that's why WITH_LEAN is enabled by default. Can you try to disable WITH_LEAN?

Regards, Elmar

Changed 7 years ago by Bill Jeffreys <wjeffreys@…>


I commented out the WITH_LEAN define for Windows CE. This required me to define ERANGE in stdsoap2.h. Also, it also required me to create the UNIX time functions (which I was able to find an open source library). This enabled me to compile the code. There were still several areas in the stdsoap2.c code that I had to add compile time flags for Windows CE. I now have the A/C simple device running on my target.

Thanks for your help, Bill

Changed 6 years ago by elmex

  • status changed from assigned to closed
  • resolution set to worksforme

Created ticket to track windows ce support #123

Add/Change #101 (setsockopt(IP_ADD_MEMBERSHIP) fails for Windows CE)


E-mail address and user name can be saved in the Preferences.

as closed
The resolution will be deleted. Next status will be 'reopened'
Note: See TracTickets for help on using tickets.