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: [email protected]
Mobile: +27 (0)83 230 8466

<<signature.jpg>>

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

Reply via email to