Dear Group Members:
I am a newer to lwip and encounter problems doing UDP multicast for
receiving and sending using netconn API.I've enabled the IGMP code in lwip
and everything builds OK. The source code is as followed:
===================source code=======================
static void MulticastTask(void *p_arg)
{
struct ip_addr interfaceAddr,*addr,multicastAddr;
struct in_addr netAddr;
char addrStr[INET_ADDRSTRLEN] ;
struct netbuf *buf,*sendBuf;
struct netconn *multiCast;
char data[]="hi";
static unsigned short port;
multiCast=netconn_new(NETCONN_UDP) ; //create netconn
/*port=5000, err=0*/
err=netconn_bind(multiCast,
IP_ADDR_ANY, htons(5000));
/*IP address "192.168.0.2"*/
IP4_ADDR(&interfaceAddr,192,168,0,2);
/multicast address "224.0.0.107" */
IP4_ADDR(&multicastAddr,224,0,0,107);
err=netconn_join_leave_group(multiCast,&multicastAddr,\
&interfaceAddr,NETCONN_JOIN);//err=0
while(1)
{
/*receive multicast packets*/
buf = netconn_recv(multiCast);
}
===================source code=======================
I have already seen "Problem doing UDP multicast receive using netconn API"
with URL
http://lists.gnu.org/archive/html/lwip-users/2010-07/msg00100.html.NETIF_FLAG_IGMP
was set by the following code:
#ifdef LWIP_IGMP
netif->flags |= NETIF_FLAG_IGMP | NETIF_FLAG_BROADCAST;
#endif
I cann't receive packet by the above efforts.Please help me to solve
my problem.
Thanks.
YiZheng
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users