This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin 1.5.18: Problem using setsockopt() for multicast


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


Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]