Joining and Leaving an IGMP Host Group
µC/TCP-IP supports IP multicasting with IGMP. In order to receive packets addressed to a given IP multicast group address, the stack must have been configured to support multicasting in net_cfg.h, and that host group has to be joined.
The following examples show how to join and leave an IP multicast group with µC/TCP-IP:
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. */ } |