lua-users home
lua-l archive

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


On Thu, Mar 01, 2007 at 03:21:09PM -0800, Taj Khattra wrote:
> >Or on unix. We must use shutdown() to do a half-close, which is what
> >well behaved clients and servers do.
> 
> <rant> http://cr.yp.to/tcpip/twofd.html </rant>

Do you understand what he's trying to say? I don't. Half-close is needed
only when you read AND write on the same fd, as for HTTP. In his
pipeline case, each side of the connection only reads OR writes, so
doing a close() works fine, you can do as he describes without trouble.

Maybe he had trouble on one of the ancient systems he alleges can be
crashed by calling getsockopt(), and hasn't got around to updating the
web page.

Anyhow, representing a socket as a single fd allows it to be used by
existing code that reads and writes from a single fd, think "file" here,
avoiding "device specific garbage", as he says. Does he want two fds for
files, as well, one reading one writing? Calling two fds "obvious" is a
bit of a stretch... :-)

Sam