Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

IPv4 Multicasting

µC/TCP-IP supports IPv4 multicasting with IGMP. In order to receive packets addressed to a given IP IPv4 multicast group address, the stack must have been configured to support multicasting in net_cfg.h, Multicast Configuration, and that host group has to be joined.

The following examples show how to join and leave an IPv4 multicast group with µC/TCP-IP:

 

...

Code Block
languagecpp
firstline1
linenumberstrue
NET_IF_NBR   if_nbr;
NET_IP_ADDR  group_ip_addr;
NET_ERR      err;
 
 
if_nbr        = NET_IF_NBR_BASE_CFGD;
group_ip_addr = NetASCII_Str_to_IP("233.0.0.1", &err);
if (err != NET_ASCII_ERR_NONE) {
  /* Handle error. */
}
NetIGMP_HostGrpJoin(if_nbr, group_ip_addr, &err);
if (err != NET_IGMP_ERR_NONE) {
  /* Handle error. */
}
[...]
NetIGMP_HostGrpLeave(if_nbr, group_ip_addr, &err);
if (err != NET_IGMP_ERR_NONE) {
  /* Handle error. */
}


Info
Refer to functions NetIGMP_HostGrpJoin and NetIGMP_HostGrpLeave for more details.

IPv6 Multicasting

µC/TCP-IP supports IPv6 multicasting with MLDP. In order to receive packets addressed to a given IP IPv6 multicast group address, With IPv6 MLDP is always enabled but you might need to increase the number of group, see Multicast Configuration.

 

The following examples show how to join and leave an IPv6 multicast group with µC/TCP-IP:

 

...

Code Block
languagecpp
firstline1
linenumberstrue
NET_IF_NBR     if_nbr;
NET_IPv6_ADDR  group_ip_addr;
NET_ERR        err;
 
 
if_nbr        = NET_IF_NBR_BASE_CFGD;
group_ip_addr = NetASCII_Str_to_IP("FF03::1", &err);
if (err != NET_ASCII_ERR_NONE) {
  /* Handle error. */
}
NetMLDP_HostGrpJoin(if_nbr, group_ip_addr, &err);
if (err != NET_MDLP_ERR_NONE) {
  /* Handle error. */
}
[...]
NetMLDP_HostGrpLeave(if_nbr, group_ip_addr, &err);
if (err != NET_MDLP_ERR_NONE) {
  /* Handle error. */
}


Info
Refer to functions NetMLDP_HostGrpJoin and NetMLDP_HostGrpLeave for more details.