# +TCP IPv4 multicasts and IGMP

**URL:** <https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934>\
**Category:** Libraries\
**Created:** [March 9, 2021, 6:21pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934 "2021-03-09T18:21:45Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Shub](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@Shub](https://forums.freertos.org/u/Shub)\
**Post date:** [April 21, 2023, 8:50am UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/21 "2023-04-21T08:50:48Z")

</div>

Hi, @epopov, @selamta and @w2vy ,

We are creating a new FreeRTOS+TCP branch “[dev/ipv6\_integration](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/dev/IPv6_integration)” having both IPv4 and IPv6 functionalities. The branch will have both IPv4 and IPv6 unit tested , protocol tested and CBMC proofed and this branch will soon be the main branch.  
I was exploring the mcast and IGMP support and stumbled upon this thread and looked into the mcast and igmp changes in the [fork](https://github.com/evpopov/FreeRTOS-Plus-TCP/tree/Multicasts_Draft_2)  
Can we collaborate and create a formal PR for “dev/ipv6\_integration” branch and merge the changes.  
We will need your help here and we will be more than happy to help in every possible way.

---

<div class="post-metadata">

**Author:** ![selamta](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@selamta](https://forums.freertos.org/u/selamta)\
**Post date:** [April 24, 2023, 3:26pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/22 "2023-04-24T15:26:49Z")

</div>

We will be happy to help in every possible way.

---

<div class="post-metadata">

**Author:** ![Hunter](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/hunter/32/3703_2.png) [@Hunter](https://forums.freertos.org/u/Hunter)\
**Post date:** [July 11, 2023, 5:05pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/23 "2023-07-11T17:05:35Z")

</div>

Hi, is there any updates on this? I need multicast for my current project.

---

<div class="post-metadata">

**Author:** ![epopov](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@epopov](https://forums.freertos.org/u/epopov)\
**Post date:** [July 11, 2023, 5:34pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/24 "2023-07-11T17:34:08Z")

</div>

Hi @Hunter ,  
My code is still in a branch of it’s own here: [https://github.com/evpopov/FreeRTOS-Plus-TCP/tree/Multicasts\_Draft\_2](https://github.com/evpopov/FreeRTOS-Plus-TCP/tree/Multicasts_Draft_2)

Feel free to try it. Sadly, there is no getting started for it, so you’ll have to do some digging. Try something like this:

```auto
//Setup the local end point
struct freertos_sockaddr	LocalAddr;
LocalAddr.sin_port = FreeRTOS_htons(1234);
LocalAddr.sin_addr = FreeRTOS_htonl(0x00000000);

//Bind the socket to the local end point
FreeRTOS_bind( MySock, &LocalAddr, sizeof(LocalAddr));

struct freertos_ip_mreq prvMReq;
prvMReq.imr_multiaddr.sin_addr = FreeRTOS_htonl(0xEFFF0303);	// 239.255.3.3 ( Local Scope: 239.255.x.x );
prvMReq.imr_multiaddr.sin_len = sizeof( struct freertos_sockaddr);
prvMReq.imr_interface.sin_addr = FreeRTOS_htonl(0x00000000);
prvMReq.imr_interface.sin_len = sizeof( struct freertos_sockaddr);
FreeRTOS_setsockopt( MySock, 0, FREERTOS_SO_IP_ADD_MEMBERSHIP, ( void * ) &prvMReq, sizeof( prvMReq ) );

// Set the multicast TTL to one so we keep our multicasts local.
// Any multicast router should discard them and not forward them.
uint8_t xMulticastTTL = 1;
FreeRTOS_setsockopt( MySock, 0, FREERTOS_SO_IP_MULTICAST_TTL, ( void * ) &xMulticastTTL, sizeof( xMulticastTTL ) );

```

I am currently transitioning my day-job project to the IPv6 integration branch and eventually I will have to migrate my multicast/IGMP code there as well. At this point ( probably later this summer ) I plan on starting a work-in-progress PR to hopefully eventually get this stuff into the official repository.

---

<div class="post-metadata">

**Author:** ![Hunter](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/hunter/32/3703_2.png) [@Hunter](https://forums.freertos.org/u/Hunter)\
**Post date:** [July 11, 2023, 6:48pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/25 "2023-07-11T18:48:28Z")

</div>

Thanks for the info. Any idea how I could get your multicast code working with the current version of FreeRTOS-Plus-TCP?

---

<div class="post-metadata">

**Author:** ![epopov](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@epopov](https://forums.freertos.org/u/epopov)\
**Post date:** [July 11, 2023, 8:43pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/26 "2023-07-11T20:43:55Z")

</div>

If by “current” you mean the single interface IPv4-only version, then use the link I sent in my previous post.

---

<div class="post-metadata">

**Author:** ![epopov](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@epopov](https://forums.freertos.org/u/epopov)\
**Post date:** [January 26, 2024, 2:41pm UTC](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934/27 "2024-01-26T14:41:57Z")

</div>

First of all, I apologize for bringing this from the dead.  
Please do not use the links from this topic as they are no longer relevant.  
If you need support for receiving multicast packets, please do the following:

1. Check out your current version of FreeRTOS+TCP. It may already supports multicast groups. One easy way to check this is to open your FreeRTOSIPConfigDefaults.h and check if it has ipconfigSUPPORT\_IP\_MULTICAST listed in there. If it’s in there, simply copy the define to your FreeRTOSIPConfig.h and enable it.
2. If the current FreeRTOS+TCP doesn not yet officially support multicast groups, browse through the [pull requests on github](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/pulls). There will probably be a PR there that you can use until that code makes it to the official releases.

[Previous page](https://forums.freertos.org/t/tcp-ipv4-multicasts-and-igmp/11934.md?page=1)
