Unable to register mcast address in c++
i was working for a routing algo protocol in c++ on centos. centos was running on vmware .. i was able to register mcast address 224.0.0.9 when my interfaces card are connected in bridge mode in vmware. but as i connected my centos with cisco router using gns3 cloud i got errors
so overall topolgoy is like
cenots++bridgemode-----bridgemode+centos //able to add into group
centos+--vmnet1-----------+vmnet1(gns3cloud---cisco router) //unable to add into group
h=gethostbyname("224.0.0.9");
if(h==NULL) {
cout << "unknown group address"<<endl;
exit(1);
}
if memcpy((char *) &mcastAddr.sin_addr.s_addr,h->h_addr_list[0],h->h_length);
mreq.imr_multiaddr.s_addr=mcastAddr.sin_addr.s_addr; //
mreq.imr_interface.s_addr=htonl(INADDR_ANY);
int mc = setsockopt(soc,IPPROTO_IP,IP_ADD_MEMBERSHIP,(void *) &mreq, sizeof(mreq));
if(mc<0) {
cout <<"unable to join MCAST GROUP"<<endl;
printf("ERROR: %s\n", strerror(errno));
exit(1);
}
errno returns. ERROR: No such device
ps# there is only one interface eth0 using which m able to ping cisco router
Any pointer is welcomed
Thanks
|