[ENBD] Two ENBD issues
Peter T. Breuer
ptb@it.uc3m.es
Fri, 29 Sep 2000 01:09:23 +0200 (MET DST)
And to follow myself up ...
Yes, well this is a wait (select) on a single socket for read.
It's also waiting for error. It's a 6 minute timeout, so what is
happening is obviously that it is getting an error return on the
socket immediately. It's followed by a zero read, so that seems likely.
Talking to people here I discovered that my networking ignorance
extends to not knowing that a zero return from a read means the socket
has been closed at the other end. We're being signalled EOF. The
select returned "ready to read" (meaning that the read would not block)
and the read returned zero, meaning EOF.
I just didn't expect it either to return >= 0 in that case or to
repeat >= 0 after sending it the first time! Corrected. A zero
read return should be treated as a network breakage.
I am also looking at the accept() call in the head server honcho.
I think it may block forever and I should use select before it.
Trying it.
Your foregoround/background problem may have something to do with
the following para from the read() manpage:
EIO I/O error. This will happen for example when the
process is in a background process group, tries to read from
its controlling tty, and either it is ignoring or blocking
SIGTTIN or its process group is orphaned. It may also occur
when there is a low-level I/O error while reading from a
disk or tape.
With respect to the limit of 4 connections you observe, I see the
following in the listen() man page:
If the socket is of type AF_INET, and the backlog argument is
greater than the constant SOMAXCONN (128 in Linux 2.0 & 2.2), it
is silently truncated to SOMAXCONN. Don't rely on this value in
portable applications since BSD (and some BSD-derived systems)
limit the backlog to 5.
Suspicious.
Peter