Ticket #101 (closed defect: worksforme)
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: |
Description
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):
wsd_bind_multicastudp()
wsd_bind_udp()
soap_set_mode() soap_bind()
socket(AF_INET, SOCK_DGRAM, 0) always called for CE!!
setsockopt(IP_ADD_MEMBERSHIP)
I am using ws4d-gsoap 0.9 and gsoap 2.7.13. If you need more information or clarification please email me.
