Multicast recvfrom not working??????



I'm trying to setup a multicast client that listens in on eth1 witht
the address: 172.16.90.11
the address on which the stream is coming in is: 239.7.7.1
the socket is setup fine without any problems but i still don't get any
data....in the recvfrom call
i've gone through almost every reference i've found...but still can't
figure out whats going on...can anyone help...
below is the code that I'm using to set it up:

//all the used variables are defined in the header file (no compile
issues here):
//running it on a debian box enabled for multicast

memset(&mcast_addr, 0, sizeof(mcast_addr));
mcast_addr.sin_family = AF_INET;
mcast_addr.sin_port = htons(mPort);
mcast_addr.sin_addr.s_addr = inet_addr("239.7.7.1");

memset(&cli_addr, 0, sizeof(cli_addr));
cli_addr.sin_family = AF_INET;
cli_addr.sin_port = htons(mPort);
cli_addr.sin_addr.s_addr = inet_addr("172.16.90.11");

if((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP))< 0)
exit(-1);

int iSize = 65535;
if(setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char*)&iSize,
sizeof(iSize)) < 0)
exit(-1);


int bTrue = 1;
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &bTrue, sizeof(bTrue))
< 0){
exit(-1);

int ret;
if ((ret = bind(sock, (struct sockaddr*)&cli_addr, sizeof(cli_addr))
)< 0)
exit(-1);


//unsigned long Addr = cli_addr.sin_addr.s_addr;
struct in_addr interface_addr;
if(inet_aton("172.16.90.11", &(interface_addr) ) != 1)
cout << "the addr thing failed" << endl;

if(setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF,
(char*)&interface_addr, sizeof(interface_addr)) < 0)
exit(-1);


if(inet_aton(mAddress.c_str() , &(mreq.imr_multiaddr) ) != 1)
cout << "imr_multiaddr failed" << endl;
if(inet_aton("172.16.90.11", &(mreq.imr_interface)) != 1)
cout << "imr_interface failed" << endl;


if(setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq,
sizeof(mreq)) < 0)
exit(-1);

int iTTL =0;
if(setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&iTTL,
sizeof(iTTL)) < 0)
exit(-1);


if(setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, (char*)&bFalse,
sizeof(bFalse)) < 0)
exit(-1);



while(true){
int iFromLen = sizeof(from);
if(recvfrom(sock, mBuffer, MAX_SIZE, 0, &from,
(socklen_t*)&iFromLen) > 0){
cout << "got a message" << endl;
}
}

.



Relevant Pages

  • [GIT PULL] x86/setup for 2.6.36
    ... x86, setup: move isdigit.h to ctype.h, header files on top. ... -static inline int isdigit ... int strcmp(const char *str1, const char *str2); ...
    (Linux-Kernel)
  • [GIT PULL] x86/setup for 2.6.36
    ... x86, setup: move isdigit.h to ctype.h, header files on top. ... -static inline int isdigit ... int strcmp(const char *str1, const char *str2); ...
    (Linux-Kernel)
  • [GIT PULL] x86/setup for 2.6.36
    ... x86, setup: move isdigit.h to ctype.h, header files on top. ... -static inline int isdigit ... int strcmp(const char *str1, const char *str2); ...
    (Linux-Kernel)
  • [GIT PULL] x86/setup for 2.6.36
    ... x86, setup: move isdigit.h to ctype.h, header files on top. ... -static inline int isdigit ... int strcmp(const char *str1, const char *str2); ...
    (Linux-Kernel)
  • [GIT PULL] x86/setup for 2.6.36
    ... x86, setup: move isdigit.h to ctype.h, header files on top. ... -static inline int isdigit ... int strcmp(const char *str1, const char *str2); ...
    (Linux-Kernel)