Re: BSD socket accept() fd leak on iphone OS
Re: BSD socket accept() fd leak on iphone OS
- Subject: Re: BSD socket accept() fd leak on iphone OS
- From: Matt Slot <email@hidden>
- Date: Fri, 25 Sep 2009 20:06:37 -0400
On Sep 25, 2009, at 5:22 PM, Jack Brindle wrote:
I would question this. A shutdown (or a close for that matter)
simply requests that the connection be closed. If any data was on
its way, or the other end finishes sending all its queued data
before the close request is accepted, then data could indeed be
received after the shutdown or close is executed. I don't believe
(could be wrong) that it simply drops the bits on the floor. At
least this is my understanding...
shutdown() requests an "orderly disconnect" in one or both directions.
Shut down the write side to indicate that you have no more data to
send (this is often indicated on the other side by a recv() of 0
bytes). Shut down the read side to indicate you don't expect to
receive any more data.
close() simply tears down the endpoint without waiting for remote
acknowledgement. It's better to shutdown() and let the remote end
finish reading (or retrying), then close() the endpoint when both
sides are ready. Of course, you can just close() to clean up after any
connection errors as well.
Check Stevens or the UNIX Sockets FAQs for more details.
Matt Slot / Bitwise Operator / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden