lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Problems with sending UDP packets in FreeRTOS


From: Simon Goldschmidt
Subject: Re: [lwip-users] Problems with sending UDP packets in FreeRTOS
Date: Thu, 28 Jul 2016 12:46:54 +0200

Sylvain, have you read the "I tried one of Noam's linked examples (included below)" part of Mike's message? ;-)
 
Simon
 
 
Gesendet: Donnerstag, 28. Juli 2016 um 12:16 Uhr
Von: "Sylvain Rochet" <address@hidden>
An: "Mailing list for lwIP users" <address@hidden>
Betreff: Re: [lwip-users] Problems with sending UDP packets in FreeRTOS
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 ="" 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
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

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