delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/16/19:43:36

X-Spam-Check-By: sourceware.org
Date: Thu, 17 Aug 2006 01:42:10 +0200 (CEST)
From: Alessandro Saffiotti <asaffio AT aass DOT oru DOT se>
To: cygwin AT cygwin DOT com
Subject: Cygwin 1.5.18: Problem using setsockopt() for multicast
Message-ID: <Pine.LNX.4.21.0608170139450.20778-100000@aass.oru.se>
MIME-Version: 1.0
X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-1.6 (brevduva.oru.se [130.243.97.7]); Thu, 17 Aug 2006 01:43:19 +0200 (MEST)
X-oru-MailScanner: Found to be clean
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019