[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaSocket - how can a tcp client detect a closed connection?
- From: Sam Roberts <sroberts@...>
- Date: Thu, 1 Mar 2007 15:01:00 -0800
On Fri, Mar 02, 2007 at 09:40:57AM +1100, David Burgess wrote:
> On 3/2/07, Javier Guerra <javier@guerrag.com> wrote:
> >so, if the server closes the stream you can still send data; and if it
> >calls
> >read(), will get it. only when the second part (the client, in your case)
> >calls close() too, is the whole stream finished.
>
> Not so on Windows
Or on unix. We must use shutdown() to do a half-close, which is what
well behaved clients and servers do.
close() does a full-close, shuts the read and write side. Same on
windows, AFAIK:
http://tangentsoft.net/wskfaq/newbie.html
2.10
Which doesn't mean everybody does it correctly!
Sam