lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Thoughts about callbacks on socket errors


From: Bill Auerbach
Subject: [lwip-devel] Thoughts about callbacks on socket errors
Date: Tue, 12 Jun 2012 14:21:02 -0400

This applies to the RAW API. I've noticed something that I think I would do
differently by default depending on what the user has done as far as
callback setup is concerned.

When a socket is closed normally by the client, pcb->recv is called with
struct pbuf *p == NULL to indicate the connection is closed.  If the client
aborts the connection, pcb->errf is called.  If the application doesn't call
tcp_err it doesn't get notified that the socket has closed by an error or
abort.  I would think if pcb->errf is NULL that TCP_EVENT_RECV should be
used with a NULL pbuf pointer.  The application might not handle errors or
need to know if the socket closed because of an error but I think it should
always be notified that the socket closed and it's consistent then in the
use of tcp_recv to notify of the socket closing.

I could even see calling tcp_recv with a NULL pbuf pointer being called
regardless of tcp_err being used in order to be consistent on socket close
notifications.

Bill




reply via email to

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