Hi,
I am trying to broadcast the data using lwip netconn api.I use the following example to check the broadcast data but its not working .I want to send the data on ip 255.255.255.255.
struct netconn *conn;
char msg[]="testing" ;
struct netbuf *buf;
char * data,sample;
conn = netconn_new( NETCONN_UDP );
sample=netconn_bind(conn, IP_ADDR_ANY, 1234 ); //local port
printf("bind:%d",sample);
sample=netconn_connect(conn, IP_ADDR_BROADCAST, 1235 );
printf("conn:%d",sample);
vTaskDelay( 2000 ); //some delay!
for( ;; )
{
buf = netbuf_new();
data ="" sizeof(msg));
memcpy (data, msg, sizeof (msg));
sample= netconn_send(conn, buf);
printf("sample:%d",sample);
netbuf_delete(buf); // De-allocate packet buffer
vTaskDelay( 2000 ); //some delay!
}
netconn_send(conn, buf); always return 250.please help me.
thanks in advance