Cygwin 1.5.18: Problem using setsockopt() for multicast
Václav Haisman
v.haisman@sh.cvut.cz
Thu Aug 17 07:46:00 GMT 2006
Alessandro Saffiotti wrote:
> Hi there,
>
> I ran into the following problem when using setsockopt to create a
> multicast receiver in my own application. Here is the relevant part
> of the code:
>
> ----------------------------------------------------------------------
> .
> .
> .
> tcp_broadcast_receiver = socket(PF_INET,SOCK_DGRAM,IPPROTO_IP);
>
> memset(&imreq, 0, sizeof(struct ip_mreq));
> imreq.imr_multiaddr.s_addr = inet_addr("227.1.3.5");
> imreq.imr_interface.s_addr = INADDR_ANY;
>
> if(setsockopt(tcp_broadcast_receiver, IPPROTO_IP, IP_ADD_MEMBERSHIP,
> (const void *)&imreq, sizeof(struct ip_mreq)) != 0)
> perror("Error joining multicast group");
> .
> .
> .
> ----------------------------------------------------------------------
>
> It compiles ok, but when I run it setsockopt fails producing the
> following report:
>
> Error joining multicast group: Invalid argument
>
> I have noted that a similar problem was reported long time ago, when
> support for multicast was not implemented, but I understand that this
> support is not available.
>
> I have also read the discussion about the conflicting values for
> constants between winsock1 and winsock2. I have tried to replace
> IP_ADD_MEMBERSHIP by hardcoding either 5 (winsock1) or 12 (winsok2),
> but I get the same behavior.
>
> I run Cygwin 1.5.18 on Windows XP pro SP2.
>
> Any hints?
> Thanks!
>
> Alessandro Saffiotti
>
I do not know whether it works with 1.5.21 but you should always test
with the latest version before you create a problem report.
--
Vaclav Haisman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 542 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060817/36a9e691/attachment.sig>
More information about the Cygwin
mailing list