public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bind to multicast address fails
@ 2014-05-13 14:36 Moritz Warning
  2014-05-13 14:59 ` Corinna Vinschen
  0 siblings, 1 reply; 3+ messages in thread
From: Moritz Warning @ 2014-05-13 14:36 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

-----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-----

[-- Attachment #2: main.c --]
[-- Type: text/x-csrc, Size: 706 bytes --]


#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;
}

[-- Attachment #3: main.c.sig --]
[-- Type: application/pgp-signature, Size: 287 bytes --]

[-- Attachment #4: Type: text/plain, Size: 218 bytes --]

--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bind to multicast address fails
  2014-05-13 14:36 bind to multicast address fails Moritz Warning
@ 2014-05-13 14:59 ` Corinna Vinschen
  2014-05-13 15:23   ` Moritz Warning
  0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2014-05-13 14:59 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

On May 13 16:19, Moritz Warning wrote:
> -----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.

It's a problem win the underlying Winsock (again).  Maybe this discussion
on stackoverflow helps you along:

http://stackoverflow.com/questions/6140734/cannot-bind-to-multicast-address-windows

Right now I have no inclination to workaround this problem in Cygwin.
Maybe if you ping me again in a month or so.  Of course, patches are
always welcome...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bind to multicast address fails
  2014-05-13 14:59 ` Corinna Vinschen
@ 2014-05-13 15:23   ` Moritz Warning
  0 siblings, 0 replies; 3+ messages in thread
From: Moritz Warning @ 2014-05-13 15:23 UTC (permalink / raw)
  To: cygwin

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

Thanks for the pointer! :)

On 05/13/2014 04:55 PM, Corinna Vinschen wrote:
> On May 13 16:19, Moritz Warning wrote:
>> -----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.
> 
> It's a problem win the underlying Winsock (again).  Maybe this discussion
> on stackoverflow helps you along:
> 
> http://stackoverflow.com/questions/6140734/cannot-bind-to-multicast-address-windows
> 
> Right now I have no inclination to workaround this problem in Cygwin.
> Maybe if you ping me again in a month or so.  Of course, patches are
> always welcome...
> 
> 
> Corinna
> 

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

iQEcBAEBCAAGBQJTcjX7AAoJECHrh56PP4wpOooIAJSgT+YIAk+VE51D090yJF2W
lA/cedxkIYW2poOeZYrgVF6q76gLHsrD1Ul6Xepbc7hRWBgTBjGYedCa/IUFYNqu
+N/+3RKTSn9VbgixJxN6N3AJip/rcFj/N7lgc9i1HJQX4g0lJa0p9s18sujBH2/J
0RCKf860SSkBHj4sdmCO/EfkfPFFfb6hQjvOYeFdkYP0Blb3Gp5Db9VYqG9WsfxV
o4g5tXyM1TGs5CElkyFwC9fGvpT9o9Q4P/6BvOPxGJ3G10v3rvY3Bdd9QeE5HrpD
UCouBCgcLcL5nBuzWzYqFG6Wklnxnnv3bsoSd199uALAcPtms1djWLiQusbYe4A=
=1QHo
-----END PGP SIGNATURE-----

--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-13 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 14:36 bind to multicast address fails Moritz Warning
2014-05-13 14:59 ` Corinna Vinschen
2014-05-13 15:23   ` Moritz Warning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).