Socket help wanted

Steve Mawer scm at datlog.co.uk
Tue Jul 18 23:31:27 AEST 1989


I have a problem with BSD sockets, which I hope someone on the net
can give me assistance with.

I have an application which listens on a well-known port, accepts a
connection and execs a child process, then awaits further connects.
When a predetermined number of connections has been made, my program
has to stop listening until one or more of its children terminates,
freeing connection capacity for more connections.  This is to allow
potential connectees to try other machines for a connection when
capacity on one machine is reached.  With the listen pending, the
connection happens even when I'm not doing an accept, hanging up
the connecting process (although other connects will fail due to
the listen queue being full).

The program has to run in a number of environments, including Ultrix
and AIX.  The Excelan implementation is no problem, due to the way
in which they've done the socket interface (which is a pain in other
ways).

My problem is - how can I stop the outstanding listen?  I've RTFMd
but can find no relevant information.  My documentation describes
fully how make sockets and get connections, but not how to suspend
them in a temporary manner.  I've tried closing the listening socket,
but I then can't re-open it due to EADDRINUSE errors.  I've tried to
setsockopt to SO_ACCEPTCONN 'off', but that seems to have no effect
(on AIX, BTW).

Shutdown seems interesting, but there doesn't seem to be a corresponding
openup call to restart the shutdown part, it also seems to me that it
only stops 'sends' and/or 'receives', not 'reads' and/or 'writes'(?). Is
what I'm attempting impossible, or am I just missing the obvious?

Please e-mail, and I'll summarise to the net.

-
Steve C. Mawer        <scm at datlog.co.uk> or < {backbone}!ukc!datlog!scm >
                       Voice:  +44 1 863 0383 (x2153)
-- 
Steve C. Mawer        <scm at datlog.co.uk> or < {backbone}!ukc!datlog!scm >
                       Voice:  +44 1 863 0383 (x2153)



More information about the Comp.unix.questions mailing list