# Connect me 9210 Udp Multicasting

**URL:** <https://forums.digi.com/t/connect-me-9210-udp-multicasting/22343>\
**Category:** NET+OS\
**Tags:** me9210, multicast, connectme9210\
**Created:** [April 9, 2021, 12:43pm UTC](https://forums.digi.com/t/connect-me-9210-udp-multicasting/22343 "2021-04-09T12:43:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mertguler](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mertguler](https://forums.digi.com/u/mertguler)\
**Post date:** [April 9, 2021, 12:43pm UTC](https://forums.digi.com/t/connect-me-9210-udp-multicasting/22343/1 "2021-04-09T12:43:46Z")

</div>

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  
");  
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  
");  
return ;  
}  
new\_CallStatus=setsockopt(new\_multi\_server\_sock,SOL\_SOCKET,SO\_RCVBUF,(char \*)&new\_sockbufsize,sizeof(int));  
if(new\_CallStatus\<0){  
perror("Setsockopt Failed  
");  
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 *)&amp;new_multi_server_addr,sizeof(new_multi_server_addr));
    if(new_CallStatus&lt;0){
    	perror("New Creation Socket for multicasting cannot binding the port 

```

");  
return ;  
}  
else{  
printf("New Creation Multicasting socket successfuly binding the port so socket ready to read  
");  
}

```
       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 *)&amp;mreq,sizeof(mreq));
   if(new_CallStatus&lt;0){
	   return ;
   }
   else{
	   printf("success");
   }

```

---

<div class="post-metadata">

**Author:** ![marzahld](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@marzahld](https://forums.digi.com/u/marzahld)\
**Post date:** [May 19, 2021, 8:19am UTC](https://forums.digi.com/t/connect-me-9210-udp-multicasting/22343/2 "2021-05-19T08:19:12Z")

</div>

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.
