lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] UDP multicast problem usinig netconn API


From: mat henshall
Subject: Re: [lwip-users] UDP multicast problem usinig netconn API
Date: Mon, 28 May 2012 21:18:31 -0700

You usually have to enable multicast for the ip address range you are looking to receive in the underlying hardware as Multicast packets are filtered out at the hardware level (see Wikipedia multicast Article for good explanation). 

Different Ethernet and wifi hardware  will have different methods for doing this. 


On Monday, May 28, 2012, yi zheng wrote:
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


--

Mat Henshall
Founder and CEO, Square Connect, Inc.
San Jose, CA
www.squareconnect.com
cell: 650.814.7585

reply via email to

[Prev in Thread] Current Thread [Next in Thread]