|
From: | Tom C. Barker |
Subject: | [lwip-users] Closing a client connection via (flags & TCP_FIN) |
Date: | Tue, 28 Sep 2004 15:41:19 -0700 |
Hello,
Currently I have an SMTP client which closes its
connection
via a
poll method: when the connection is in CLOSE_WAIT,
the
poll method will perform tcp_close. This algorithm is
the
only example I have seen (when using tcp_connect
to get the conversation
started).
I was
considering working around all of the polling by making a
call
to TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err) where
the
_RECV function would notice the connection in CLOSE_WAIT
and
would call tcp_close. Alternatively, could I just call tcp_close()
instead of the _RECV function?
Thanks
in advance for your advice.
Tom
tcp_in.c:
case
ESTABLISHED:
tcp_receive(pcb); if (flags & TCP_FIN) { tcp_ack_now(pcb); pcb->state = CLOSE_WAIT; TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err); //call the application to close ---- or
-----
tcp_close(pcb);
} break; |
[Prev in Thread] | Current Thread | [Next in Thread] |