delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/05/13/10:19:30

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:content-type; q=dns; s=default; b=YOwSAJYcyoCGpK55sHpsNQj6klrSq
IiJ/MrnQljk6WxPuGkc/51d5u1YEBf68gqH2p2SCyUOBVFOSkpTl4kzNemCyNgVx
BMBLRciJZj0GdayWV3r/0LyMthZMp6zHarfS30tTqkBv4Fl+quVKW5a3u/YZQQ5v
zioNVdH1Z7GJzQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:content-type; s=default; bh=0ZdZxhJosnON7+pT8MmDeykjtro=; b=MWd
HyhitKu47N3TkUkyonrj3nirSfTTGJvqw8i7vOdaMGcEORVM5Znc+Jkunj6BD8jT
Vx+n7XLEjFJUH1772iIu2iIzwn+NjT+ia5UYHEuxMgsIFnnilNQiyb7wXdDmZKDR
mkiihVexwAiW3F0aNYCz9cWeMxdNZCjf66mzKLBg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mout.web.de
Message-ID: <53722A02.5070201@web.de>
Date: Tue, 13 May 2014 16:19:46 +0200
From: Moritz Warning <moritzwarning AT web DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: bind to multicast address fails
X-IsSubscribed: yes

--------------080106030801020804000604
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

I try to bind a socket to a multicast address (239.192.202.5). But it fails with an error:
"Cannot assign requested address"

Is this not supported using Cygwin? I've added a simple test program in case someone wants
to verify.

Thanks,
mwarning
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBCAAGBQJTcioBAAoJECHrh56PP4wpXmYH/AyT0e32GL2GxSr5DZexNEkA
lGY3wYUlNkEjkzrFxTNOoTvDTg0nvDD5q9jMH1WoKObbwbhvG27qn3m/iZL4g/HD
DPW935mCEpSp5ryKGUyHBuS28IkLWYhgFZyUF7Uz0zG3VWcdKPo4G/O+/imT7Un4
+2gPJl7wwVsEtmBnxso3EixBBroLIO/w0gd/4b7XEfsInWhe1/GSTdjROTqUh5bY
gmMJIu3kiShGlYdq0c4BcnPgTcJewfunVMLLyl3zoq2KnHof1BqKGP8k6cibuCRo
SRs0meCQX19azuivoX01synqfddB9x/XHbtoiUe3Mxnq/KhUogh5bI5QJgNyGqI=
=HUpc
-----END PGP SIGNATURE-----

--------------080106030801020804000604
Content-Type: text/x-csrc;
 name="main.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="main.c"


#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/socket.h>

int main( int argc, char **argv ) {
	struct sockaddr_in sockaddr;
	if( inet_pton(AF_INET, "239.192.202.5", &sockaddr.sin_addr) != 1 ) {
		printf("parse errorr\n");
		return 1;
	}
	sockaddr.sin_family = AF_INET;
	sockaddr.sin_port = htons(6771);

	int sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );

	socklen_t addrlen= sizeof(struct sockaddr_in);
	if( bind( sock, (struct sockaddr*) &sockaddr, addrlen ) < 0 ) {
		//close( sock );
		printf( "Failed to bind socket to address: %s\n", strerror( errno ) );
		return 1;
	}

	printf("It works.\n");
	//close( sock );
	return 0;
}

--------------080106030801020804000604
Content-Type: application/pgp-signature;
 name="main.c.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="main.c.sig"

iQEcBAABAgAGBQJTcioCAAoJECHrh56PP4wpESQIANY0Z5BpxBM1n1LpLyEm
pOQNvyUwLqFPTE1JQq+/Z1AmDvJqgnzCqFH9+hygIY3xdSoBO/2R3MNopyxO
UpyntWhs5Pebpp86zED9gTBSeAWNoL92lcaMEvofK2voFhBuGwJyk2sVFDfR
qstxQdqqomVJUbhaQGHllixISTKrz6YNVoDJIxTn3dp47/zq4fBLE28HnASN
yaJg1TuKA1kn4Vy6tKuWw9K7ZnvYSjvx4HW6Y35fJa61ost6kTSwWS4TEtdn
2yB3pRre2we7zMwWGto8PRQ877UIdtvkmRrMjGafnUTx8qCAYJa6zyaMtxVo
85CkPPyo9yrm54m0S9a2/uA=


--------------080106030801020804000604
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


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