Home/Support/Support Forum/Connect me 9210 Udp Multicasting
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Connect me 9210 Udp Multicasting

0 votes
Hello there

I am working on Digi Connect Me 9210

What I want to do is very simple, I have a multicast device and I need to receive the udp packets from this device, so 'udp multicasting receiver' but I cannot join the range that is multicasting by the device.

mreq.imr_multiaddr.s_addr = NAInet_addr (VALUE_MULTICAST_POINTER);
mreq.imr_interface.s_addr = INADDR_ANY;

new_CallStatus = setsockopt (new_multi_server_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) & mreq, sizeof (mreq));

new_CallStatus always return -1;

So what should I think?
1) Connect me 9210 doesn't support multicasting?
2) Is there a logical error in the code I wrote?
3) Should i go another way to enable multicasting on Connect me 9210?


new_multi_server_sock=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(new_multi_server_sock<0){
perror("Socket Creation Failed \n");
return ;
}
new_CallStatus=setsockopt(new_multi_server_sock,SOL_SOCKET,SO_REUSEADDR,(const char *)&new_optval,sizeof(int));
if(new_CallStatus<0){
perror("Setsockopt Failed \n");
return ;
}
new_CallStatus=setsockopt(new_multi_server_sock,SOL_SOCKET,SO_RCVBUF,(char *)&new_sockbufsize,sizeof(int));
if(new_CallStatus<0){
perror("Setsockopt Failed \n");
return ;
}
new_multi_portno=INTVAL_MULTICAST_PORT_NUMBER;
memset((char *)&new_multi_server_addr,0,sizeof(new_multi_server_addr));
new_multi_server_addr.sin_family=AF_INET;
new_multi_server_addr.sin_addr.s_addr=htonl(INADDR_ANY);
new_multi_server_addr.sin_port=htons((unsigned short)new_multi_portno);




new_CallStatus=bind(new_multi_server_sock,(struct sockaddr *)&new_multi_server_addr,sizeof(new_multi_server_addr));
if(new_CallStatus<0){
perror("New Creation Socket for multicasting cannot binding the port \n");
return ;
}
else{
printf("New Creation Multicasting socket successfuly binding the port so socket ready to read \n");
}

mreq.imr_multiaddr.s_addr = NAInet_addr(VALUE_MULTICAST_POINTER);
mreq.imr_interface.s_addr = INADDR_ANY;

new_CallStatus=setsockopt(new_multi_server_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,(char *)&mreq,sizeof(mreq));
if(new_CallStatus<0){
return ;
}
else{
printf("success");
}
asked Apr 9 in NET+OS by mertguler New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
Not sure if this is your problem or not, but one of the things I had to learn the hard way, is that *some* stacks require the source gateway address to be valid for source network (even if there is no gateway on the network). The Treck stack used by Net/OS does indeed require a gateway ip specified and valid, or multicast will not work. Strange, I know, but that's how it works. Took me a ton of time to figure this out.
answered May 19 by marzahld New to the Community (6 points)
...