lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip 1.2.0 + freeRTOS


From: Simon Goldschmidt
Subject: Re: [lwip-users] lwip 1.2.0 + freeRTOS
Date: Mon, 25 Jan 2010 13:09:40 +0100

You're using an old version, added an extra sleep and violate api layering. Any 
reasons for that? ;-)

Sirjee Rooplall wrote:
> Hi, I am using lwip 1.2.0 under freeRTOS, I am also using PPP + external
> modem to establish a PPP connection to a server over GPRS.

Using such an old version is not recommended and makes it hard to track down 
bugs as they might already have been fixed by now. 1.2.0 is over three years 
old by now.

> All works well, provided I can establish a connection to the server and
> the connection is closed.
> 
> If for some reason the connection is not closed, i.e the TCP/IP stack does
> not get to the FIN_2 closing state, all hell breaks loose and my system
> crashes when I attempt to re-connect to the server.
> 
> I s there an elegant way to remove the connection witout causing future
> failure.
> 
> To connect I use:
> 
> conn = netconn_new(NETCONN_TCP);
> netconn_connect(conn, IP, PORT);
> vTaskDelay(100); // wait 100ms

What's that for? (I mean, I could have guessed the comment if it wasn't there, 
but why sleep?)

> Then I check the state of the pcb:
> if (conn->pcb.tcp->state == ESTABLISHED)

This is a total no-go! Don't ever (I really mean never!) access the pcb from 
your netconn application code. The netconn API is exists for you not having to 
worry about the raw API. Just because you have the struct definition doesn't 
mean you know what you are doing (see below).

> {
>   conn->state = NETCONN_CONNECT;

And where did you get that from? Please, don't "mess around" with internal 
netconn members. In this case, you tell the netconn it is in state 'connecting' 
after netconn_connect has returned (which means successfully or not) which no 
doubt leads to problems!

Please have a look at other (example-) netconn apps (you can find some by 
downloading the contrib module from cvs) and make sure you use the api 
correctly!

Simon
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser




reply via email to

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