lua-users home
lua-l archive

Re: LuaSocket - how can a tcp client detect a closed connection?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


--- 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/

AltStyle によって変換されたページ (->オリジナル) /