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

Re: How does inetd work?

Dirk <noisyb@web.de> writes:

> I know inetd forwards a programms (servers) stdout to the client... but
> where does it forward the requests from a client to? It's not stdin..
> It there any simple example server available that was written to work
> with inetd?

There is Stephens' UNIX Network Prgramming, vol 1, 2nd edition.

To summarize:
inetd listen to some given port (given by /etc/inetd.conf).
When a connection happens, inetd forks the server. The child process
closes all the file descriptos except for the new socket connection. It
call dup2() three times, duplicating 0, 1, 2 (stdin, stout,
stderr). Closes the socket.  Child exec() the server.  The server
therefore uses stdin, stdout, and stderr to communicate with the other
At the parent, the parent (inetd) closes the socket.

I think proftpd can work with inetd.

John L. Fjellstad
web: http://www.fjellstad.org/          Quis custodiet ipsos custodes

Reply to: