Hi all,
I am running lwip + freertos on a LPC2468 and using the YAGARTO tool chain.
I have two task running, which uses lwip. One which is serving a webpage
(listening pcb) and the other which
is connecting to a remote server once every minute (TCP connection).
in lwipopts.h i have the following define:
/**
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
* (requires the LWIP_TCP option)
*/
#define MEMP_NUM_TCP_PCB 10
Now when i connect to the devices webpage, the number of used tcp_pcb goes up.
And after 10 page hits, the stats say the following:
TCP_PCB avail: 10TCP_PCB used: 10TCP_PCB max: 10TCP_PCB err: 5TCP_PCB_LISTEN
avail: 3TCP_PCB_LISTEN used: 1TCP_PCB_LISTEN max: 1TCP_PCB_LISTEN err: 0
i've thought that "TCP_PCB used" should be 2, one for each connection. But that
is not the case.
Is there anything i can do to avoid this situation ?
here is my code for my webserver task:
....
// Setup ethernet interface
HandleDHCP();
// Create a new tcp connection handle
pxHTTPListener = netconn_new( NETCONN_TCP );
netconn_bind(pxHTTPListener, NULL, webHTTP_PORT );
netconn_listen( pxHTTPListener );
/* Loop forever */
for( ;; )
{
if (netif_is_up(&EMAC_if))
{
/* Wait for connection. */
// Set receive timeout. This is a "hack" into LWIP and is not thread
safe. But since
// the connection isn't shared between tasks, this should be OK!
// We set a receive timeout to prevent netconn_accept() from blocking
// this task indefinitely. If the ethernet interface is brought down.
pxHTTPListener->recv_timeout = 1000;
pxNewConnection = netconn_accept(pxHTTPListener);
if(pxNewConnection != NULL)
{
// Service connection.
vProcessConnection( pxNewConnection );
while( netconn_delete( pxNewConnection ) != ERR_OK )
{
vTaskDelay( webSHORT_DELAY );
}
}
}
else
{
// Setup ethernet interface
HandleDHCP();
vTaskDelay( webSHORT_DELAY );
}
}
Should the above cause this behaviour ?
Beset regards,
Martin
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users