Problems with inetd/tcp

Operator maximus!root at uunet.uu.net
Thu Jul 26 07:53:46 AEST 1990


1) Background

I have been trying to write a TCP network service that provides a unique
identifier upon request.  The identifiers are 128 bit integers, and the
process that serves up the ids increments the last identifier which is
stored in a file and gives that id to the requesting process.  The server
process uses locks on the id file to give exclusive access to the id file
so that multitple server processes can be active.  The server process is
invoked through inetd, it gets a number, blasts it back through file
descriptor 1 and exits.  The client also closes its socket file descriptor
when it gets back its 16 bytes.

2) The Problem

The problem is that inetd appears to get overrun by requests extremely
easily.  The mechanism appears to support 1 request every couple of
seconds.  If a single client runs a loop that opens the socket (etc, etc)
and gets the id, I have to put a sleep(1) statement in the loop!
Otherwise, the client process hangs after 30-60 requests.  If I kill the
client and retry the request, the connection is refused by inetd.  If I
wait a few minutes and try again, inetd will accept a few connections, and
I will again get a few id's. (Is there some cleanup going on that I don't
know about?)

3) Additional info

I've doing this primarily on Sun SparcStation 1's running 4.0.3, but I've
tried this on Sun 3's and it has the same behavior.  The man page suggests
closing the socket file descriptor (client side) and getting a new one
when the connection is refused.  This does not work.  Also, I'm stuck with
using TCP.

4) Help!!  (Question: Am I abusing the inetd facility???)

Bob Wise
Maxim Technologies
uunet!maximus!rmwise
703-893-3660 (feel free to call)



More information about the Comp.sys.sun mailing list