* problems with using multicast
@ 2003-05-12 7:18 Shantanu.Gogate
0 siblings, 0 replies; only message in thread
From: Shantanu.Gogate @ 2003-05-12 7:18 UTC (permalink / raw)
To: linux-kernel
Hi,
I am trying to use multicast in an application which. I am running
kernel 2.4.19.I have interfaces lo, and eth0 on bootup. Here is what I
am trying to do...
When i try to create a socket which becomes a member of a multicast
group by specifying the grp address and using INADDR_ANY as the
interface to use, i am able to receive packets sent out the multicast
group. However if i specifically bind it to the address of eth0 and then
try to receive packets...i am not getting any....The only other
interfaces i have are lo. I cant explain why it is working when i use
INADDR_ANY and does not receive packets when i use the specific address
of the device....
the code for this socket init looks as follows ...i have removed error
handling for readability right now
--------------
server_socket = socket(AF_INET, SOCK_DGRAM,0);
memset(&saddr,0,sizeof(struct sockaddr_in));
saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.sin_port = port;
bind(server_socket, (struct sockaddr *) &saddr, sizeof(saddr);
on=1;
setsockopt(server_socket,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(on));
mreq.imr_multiaddr.s_addr = mcast_addr;
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
setsockopt(server_socket,SOL_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq))
ttl = 1;
setsockopt(server_socket, IPPROTO_IP, IP_MULTICAST_TTL,&ttl,sizeof(ttl))
loop = 0;
setsockoptserver_socket,IPPROTO_IP,IP_MULTICAST_LOOP,&loop,sizeof(loop))
return server_socket;
----------------------------------
if i replace INADDR_ANY with the actual interface address which i get
using ioctl, then i cant receive any packets... However when i see the
dump from tcpdump i can see the packets coming in, but for some reason
they are not reaching the socket which had become a member. I can also
see that the group membership was added if i do netstat -g
I would appreciate any help.
Thanks and regards,
Shantanu.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-12 7:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12 7:18 problems with using multicast Shantanu.Gogate
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®