- Reference manual
All modern Unix systems handle a large number of the services they
run through the super-server inetd or one of its descendants (xinetd, systemd
etc.) Such a program reads a configuration file (for example
and opens server-sockets on all ports defined in this file. As a request
comes in it accepts it and starts the associated server such that
standard I/O is performed through the socket. This approach has several
- Simplification of servers
Servers don't have to know about sockets and -operations.
- Centralised authorisation
Using tcpwrappers and similar tools, simple and effective firewalling of all services can be realised.
- Automatic start and monitor
The inetd automatically starts the server‘just-in-time' and starts additional servers or restarts a crashed server according to its configuration.
The very small generic script for handling inetd based connections is
inetd_httpd, defining http_server/1:
- Initialises and runs http_wrapper/5 in a loop until failure or end-of-file. This server does not support the Port option as the port is specified with the inetd configuration. The only supported option is After.
Here is the example from
#!/usr/bin/pl -t main -q -f :- use_module(demo_body). :- use_module(inetd_httpd). main :- http_server(reply).
With the above file installed in
the following line in
/etc/inetd enables the server at port
4001 guarded by tcpwrappers. After modifying inetd, send the
HUP signal to make it reload its configuration.
For more information, please check inetd.conf(5).
4001 stream tcp nowait nobody /usr/sbin/tcpd /home/jan/plhttp/demo_inetd