- Reference manual
All modern Unix systems handle a large number of the services they
run through the super-server inetd. This program reads
/etc/inetd.conf 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 refers to the socket. This
approach has several advantages:
- Simplification of servers
Servers don't have to know about sockets and -operations.
- Centralised authorisation
Using tcpwrappers simple and effective firewalling of all services is 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 the specifications.
The very small generic script for handling inetd based connections is
inetd_httpd, defining http_server/1:
- http_server(:Goal, +Options)
- 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 :-