Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2001 15:23:03 -0400 (EDT)
From:      Garrett Wollman <>
To:        "Jonathan Graehl" <>
Cc:        <freebsd-net@FreeBSD.ORG>
Subject:   Do I need to close after shutdown if I don't want to leak descriptors? (making sure TCP retransmits all my data)
Message-ID:  <>
In-Reply-To: <000001c0d6d5$87607e80$>
References:  <000001c0d6d5$87607e80$>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
<<On Mon, 7 May 2001 02:10:14 -0700, "Jonathan Graehl" <> said:

> Problem: close() does not perform an orderly shutdown, does not resend
> unacknowledged data - responds with RST to data/acks sent to me

I suggest that this is a bug.

> Incomplete solution: shutdown(SHUT_RDWR), but then what?  Will the OS
> close the fd for me once the other end acknowledges, or better yet,
> closes its end as well, or do I need to close the fd?

No, you still have to close.

> (selecting for readable is not a solution; if they have
> sent me data I am uninterested in reading, I will select readable)

selecting for an exception *should* do what you want, but doesn't
(this is also a bug).

> Obviously, if shutdown fails (it shouldn't, I die on failure), you would
> need to close to avoid descriptor leakage.  But do I need to babysit the
> descriptor after I have no more interest in it?

Yes.  shutdown != close.


To Unsubscribe: send mail to
with "unsubscribe freebsd-net" in the body of the message

Want to link to this message? Use this URL: <>