lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] using netconn_close and netconn_delete


From: Jonathan Larmour
Subject: Re: [lwip-users] using netconn_close and netconn_delete
Date: Sat, 07 Jun 2008 01:41:15 +0100
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515)

Dustin Stahlback wrote:

I use freeRTOS along with lwip 1.3.x latest cvs.  A smtp client runs in
a different task from the lwiptcp task.  I create a smtp client task,
perform the function using the netconn interface (netconn_new,
netconn_bind, netconn_connect, netconn_write, netconn_recv,
netconn_close, netconn_delete).  When my task has completed I call
netconn_close and then netconn_delete on the PCB.  I then kill the RTOS
task and create another smtp task.  When I go to call netconn_connect I
get the errors ERR_ABRT or ERR_USE.  I don't know if it's timing or if
calling netconn_connect allows me to make another connection.  Is there
a certain time limit I should wait when creating/destroying my task or
am I using the netconn interface incorrectly?

At a guess you are calling netconn_bind again so that you can bind it to the same local port. For a client you do not normally need to call netconn_bind, so are you sure you need to? If not, simply omit that step, or if you want to bind the IP address, but not the port, then set the port to 0. The problem is probably because the port, while closed, has not finished being used for valid reasons in the context of the TCP protocol. lwIP does not support SO_REUSEADDR so if a socket is stuck for a while in the TIME_WAIT state after closing, nothing else can bind to it.

Although in saying that, I would have expected that it would have been netconn_bind that returned an error in that case, not netconn_connect.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine




reply via email to

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