Question regarding RST packet and the tcp stack

Andrew Schmidt Andrew.Schmidt at impactmobile.com
Fri Nov 15 15:22:46 UTC 2013


> "3.5.  Closing a Connection
> 
>   CLOSE is an operation meaning "I have no more data to send."  The
>   notion of closing a full-duplex connection is subject to ambiguous
>   interpretation, of course, since it may not be obvious how to treat
>   the receiving side of the connection.  We have chosen to treat CLOSE
>   in a simplex fashion.  The user who CLOSEs may continue to RECEIVE
>   until he is told that the other side has CLOSED also.  Thus, a program
>   could initiate several SENDs followed by a CLOSE, and then continue to
>   RECEIVE until signaled that a RECEIVE failed because the other side
>   has CLOSED.  We assume that the TCP will signal a user, even if no
>   RECEIVEs are outstanding, that the other side has closed, so the user
>   can terminate his side gracefully.  A TCP will reliably deliver all
>   buffers SENT before the connection was CLOSED so a user who expects no
>   data in return need only wait to hear the connection was CLOSED
>   successfully to know that all his data was received at the destination
>   TCP.  Users must keep reading connections they close for sending until
>   the TCP says no more data."

Apologies in advance, but can you confirm  that a "CLOSE" means either a FIN or RST?

I've read this section over and over, and I still don't fully understand where it confirms those bytes should be readable (I'm sure you are correct, but I just need to be able to explain this to someone else, and right now I'm not 100% clear)

For instance this part:

> A TCP will reliably deliver all
>   buffers SENT before the connection was CLOSED so a user who expects no
>   data in return need only wait to hear the connection was CLOSED
>   successfully to know that all his data was received at the destination
>   TCP.

Seems to be talking about the side that is closing the connection (which in my example is the remote side).  I'm more interesting in the receiving / host side which hasn't closed any part of it's connection and receives those 3 separate packets (PSH, PSH+ FIN,  RST)


> > I've looked over the TCP rfc:  http://www.rfc-editor.org/rfc/rfc1122.txt .
> 
> The TCP RFC is: http://www.ietf.org/rfc/rfc793.txt

Sorry, that was a bad copy/paste

Thanks for your help

Andrew,


More information about the freebsd-net mailing list