|
From: | Sirjee Rooplall |
Subject: | [lwip-users] lwip 1.2.0 + freeRTOS |
Date: | Mon, 25 Jan 2010 11:15:40 +0200 |
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.
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
Then I check the state of the pcb:
if (conn->pcb.tcp->state ==
ESTABLISHED)
{
conn->state =
NETCONN_CONNECT;
}
else
{
// CloseConnection();
}
void CloseConnection(void)
{
err_count = 4;
while( netconn_close( pxSeverConnectionHandle ) != ERR_OK ) { if (--err_count == 0) break; vTaskDelay( 10 ); } err_count = 4; err_count = 4;
while( netconn_delete( pxSeverConnectionHandle ) != ERR_OK ) { if (--err_count == 0) break; vTaskDelay( 10 ); } vPortEnterCritical();
pxSeverConnectionHandle = NULL; vPortExitCritical(); } What am I doing wrong in my approach that could be
causing this problem.
Kind Regards,
Sirjee Rooplall Figment Design laboratories (Pty) Ltd mailto: address@hidden Mobile: +27 (0)83 230 8466 ![]() |
[Prev in Thread] | Current Thread | [Next in Thread] |