Hi Mike,

On Thu, Jul 28, 2016 at 10:52:50AM +0100, Mike Fleetwood wrote:
> 
> I tried one of Noam's linked examples (included below) - but that showed
> exactly the same problem, stopped sending after about 20 minutes (I couldn't
> tell if it was ERR_USE again, but no reason to think it was any different!).

Well, given how much the snippet below is defective, I assume your whole 
software quality is between poor to critically wrong. Given that, the 
bug is probably in your low level netif driver.


> void udp_test2(void *arg)
> {
>   struct netconn *conn;
>   char  msg[]="testing" ;
>   struct  netbuf *buf;
>   char  * data;
> 
>   conn = netconn_new( NETCONN_UDP );

Woah, you REALLY HAVE TO check if netconn_new returns a non NULL conn.


>   netconn_bind(conn, IP_ADDR_ANY, 1234 ); //local port

You also have to check if netconn_bind actually worked…


>   netconn_connect(conn, IP_ADDR_BROADCAST, 1235 );

You also have to check if netconn_connect actually worked…


>   for( ;; )
>   {
>     buf = netbuf_new();

Woah, you REALLY HAVE TO check if netbuf_new returns a non NULL buf.


>     data =netbuf_alloc(buf,  sizeof(msg));

Woah, you REALLY HAVE TO check if netbuf_alloc returns a non NULL data.


>     memcpy (data, msg, sizeof (msg));

You probably wanted to use sizeof(msg)-1 and not sizeof(msg) here, given 
you wanted to send a static string.


>     netconn_send(conn, buf);
>     netbuf_delete(buf);  // De-allocate packet buffer
> 
>     osDelay(4);  //some delay!
>   }
> }

Dear god.


Sylvain

Attachment: signature.asc
Description: Digital signature

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to