[comp.unix.questions] Create an inetd sub-server

wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) (06/25/91)

I wish to create a new service working under inetd that, as with
telnet,ftp does stdio with the peer.

So I created a small program that does nothing except printf a text +
fflush(stdout).

I replaced in inetd.conf the ftp server with this new program.
telnet host ftp and I get the message + connection closed, as excpected.

After that, I wanted to move it on another service name.
I added a service in /etc/services similar to telnet, with a new name
and a new port number (I tried unused priviledges and non priviledged
port nulmbers).

I added a line in /etc/inetd.conf pointing to my program for the new defined
service and refreshed inetd.

telnet host new_service hangs, as if inetd could not start the application
(the connection is established). All other parameters are
identical to telnet.

Any suggestions on what makes this hanging? Did I miss an important step?


-- 
Christophe Wolfhugel    | Email: wolf@grasp1.univ-lyon1.fr
INSA - Dpt Informatique | "Le progres ne vaut que s'il est partage par tous,"
Lyon, France            | "les greves aussi. Hassan Cehef: c'est penible!"

mouse@thunder.mcrcim.mcgill.edu (der Mouse) (07/01/91)

In article <1991Jun25.071855.20102@grasp1.univ-lyon1.fr>, wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes:

> I wish to create a new service working under inetd that, as with
> telnet,ftp does stdio with the peer.

> So I created a small program that does nothing except printf a text +
> fflush(stdout).

> [This works.]

> I added a service in /etc/services similar to telnet, with a new name
> and a new port number (I tried unused priviledges and non priviledged
> port nulmbers).

> I added a line in /etc/inetd.conf pointing to my program for the new
> defined service and refreshed inetd.

Some inetds don't do the right thing with SIGHUP; try killing and
restarting inetd.

Also, if you did this too soon after killing off the old daemon, there
may be a stray socket lying around that hasn't timed out yet.

> telnet host new_service hangs, as if inetd could not start the
> application (the connection is established).

If inetd can't start the daemon, you will normally see the connection
succeed and then close instantly.  Something else is probably hanging.

> Did I miss an important step?

Did you remember to fix the daemon so it expects the connection to be
already established on file descriptor 0 instead of trying to do the
dance with socket, bind, accept, etc?

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu