Re: Question for multicast



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




.



Relevant Pages

  • Re: Too much multicasting in Linux
    ... > that didn't join the multicast address where the data is being sent. ... > the interface 0.0.0.0 causes them to receive all data. ... if I have a socket that joins the SAME ... > multicast group but is tied to a different interface it will not receive ...
    (comp.os.linux.networking)
  • Re: Too much multicasting in Linux
    ... that didn't join the multicast address where the data is being sent. ... if I have a socket that joins the SAME ... multicast group but is tied to a different interface it will not receive ... > Only on the receiving side you must join a multicast group ...
    (comp.os.linux.networking)
  • Re: Question for multicast
    ... I am implementing multicast on Windows server 2003. ... bind to a specific multicast address when created a socket. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Question for multicast
    ... I am implementing multicast on Windows server 2003. ... bind to a specific multicast address when created a socket. ...
    (microsoft.public.win32.programmer.networks)
  • Re: sending and receiving ipv6 multicasts
    ... What I thought was, that on the listener site, I ... just need to bind my socket to the interfaces ipv6 local link address ... to the multicast address. ... You need to bind to the multicast port, ...
    (comp.lang.python)

Quantcast