[Top][All Lists]

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

Re: [lwip-users] Closing tcp-Connection

From: Sergio R. Caprile
Subject: Re: [lwip-users] Closing tcp-Connection
Date: Fri, 17 Oct 2014 13:41:59 -0300
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

OK, another thing I assumed is that you were using NO_SYS=1, and forgot
to tell.
I know nothing on RTOS ports, so I will assume you are calling the right
function and respecting the single-thread restrictions, as your other
apps work.

My tcp closure is:
         state = myCLOSING;
         if(tcp_close(pcb) == ERR_OK){
                tcp_recv(pcb, NULL);
                state = myCLOSED;

tcp_close()  may fail due to a number of reasons, mostly involving low
memory situations (and I'm too lazy to dig more into the source), so if
it fails you'll have to retry later, maybe in the poll callback:
        if(state == myCLOSING){
                // Retry closing the connection

Are you checking tcp_close()'s return value ? That should give a hint.
If somehow it fails and you don't retry later, it won't close.
(Should've started there... didn't I ?)

reply via email to

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