lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: advice on recovery on a socket send


From: shogun
Subject: [lwip-users] Re: advice on recovery on a socket send
Date: Mon, 23 Aug 2010 16:50:58 -0400

<SNIP>
On Thu, 2010-08-19 at 17:36 -0400, shogun wrote:
> I have some extra stuff I more or less removed in the structure
> "mainNetInfoStruct" but ignore that.  mainNetInfoStruct does however
> contain
> the pointer to the PCB in the accept callback to be used later for
> sending.
> The question is about what to do after a send error and if I "reset"
> the
> socket correctly after the error.  The goal is to have the socket
> close and
> allow the client to reconnect.  Below is the header and the source
> code more
> or less.  Also, thanks for helping me out with this! I am sort of new
> to
> this and appreciate the help and advice.

I would delete most of the stuff in main_client_close() and just have it
call tcp_close().  This will allow any pending sends to be sent and
clean up a bit more gracefully.

I don't like the way that the listening PCB (the one returned by
tcp_listen()) isn't stored anywhere - you can never close this PCB
without a handle on it, but perhaps you never need to.

It looks to me though like if the other end tries to reconnect after the
connection has been closed then you should be fine.  What do you see
happen in this case?

Kieran


Kieran,
Thanks for the advice, I made the changes you suggested.  I still get an
error once in a while in the send but I can recover by reconnecting.  It is
working good enough for now.  The error I get is from the send and it is a
0xFF (-1)

In other words, ert = tcp_write(mainNetInfoStruct.pcb, data, size, 0);
returns the -1 0xff once in a great while.






reply via email to

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