[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: gary ng <garyng2000@...>
- Date: Mon, 5 Mar 2007 06:38:38 -0800 (PST)
--- Gé Weijers <ge@weijers.org> wrote:
> Using dup2 would give you two read/write file
> descriptors. If you
> close one nothing happens, because the Unix kernel
> waits until the
> last once is closed before doing anything. Closing
> stdout/fd 1 in a
> inetd client will not magically do a 'shutdown' on
> the sending side
> of a TCP connection. Bernstein's problem still
> exists.
But if I instead do a shutdown(), the receiving
end(i.e. the one I fork() with a dup2 stdin/out, both
use the same underlying socket), it would solve the
problem ? As it seems that shutdown a socket would
make all fds that relies on it signal EOF ?
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/