Re: Question for multicast
- From: June <June@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 20 Aug 2007 09:10:02 -0700
Thanks Arkady
Yes, the multicast group address I use is valid ( in the range of 224-239 ...)
"Arkady Frenkel" wrote:
Multicast addresses lay in a range of 224.0.0.0 to 239.255.255.255. Are you.
have such one , just a hint
Arkady
"June" <June@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D867E404-66E3-4B04-8119-C1E2D1BE0849@xxxxxxxxxxxxxxxx
Hi
I am implementing multicast on Windows server 2003. I found I cannot bind
to
a specific multicast address when created a socket. Code as follows:
socket_in sa;
UINT port=2048;
SOCKADDR_IN multiAddr=...;
::SOCKET=socket (AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(!socket)
return 0;
memset(&sa,0 sizeof(sa));
sa_sin_family=AF_INET;
sa_sin_port =HTONS(port);
sa.sin_addr.s_addr=INADDR_ANY; //If I set it to multicast address, it will
return
//error 10049 when
calling
bind(..)
if (bind(sock, (LPSOCKADDR) &sa, sizeof(sa))==SOCKET_ERROR)
return 0;
//next call setsockoption to join the group so the host can send and
receive
from the group.
So it looks like I have to assign INADDR_ANY to the address when allocate
and bind the UDP socket for multicasting. I can assign the socket with a
specific multicast address. Is it right? If yes, what if I need listen
to
more than one multicast group? Seems I cannot create another socket with
INADDR_ANY again since the address is already binded to an existing
socket.
Does it means we need listen to same socket for all multicast group?
Thanks for your help
June
- References:
- Re: Question for multicast
- From: Arkady Frenkel
- Re: Question for multicast
- Prev by Date: Re: One thread for 25 network connections
- Next by Date: Re: Question for multicast
- Previous by thread: Re: Question for multicast
- Next by thread: Re: Question for multicast
- Index(es):
Relevant Pages
|