Did you know ... | Search Documentation: |
Running the server from Unix (x)inetd |
If you are using a Unix system, one of the options for deploying the SWI-Prolog based server is to use (x)inetd. This starts a server for every client. The server will try to use Keep-Alive connections, which can greatly enhance the performance if multiple requests need to be made. If Keep-Alive is not used, this is very similar to using SWI-Prolog as a GCI script. See library(cgi) for details.
If you have applications that take long to load, you want to do session management, etc., we advice to use the multi-threaded server.
% eval `swipl --dump-runtime-variables` % sudo mkdir -p /srv/www/html/srv_demo % cd !$ % sudo cp $PLBASE/doc/packages/examples/http/demo_body.pl . % sudo cp $PLBASE/doc/packages/examples/http/demo_inetd .
% sudo tee /etc/xinetd.d/demo_swi_srv << EOF service demo_swi_srv { port = 8080 socket_type = stream protocol = tcp wait = no user = nobody server = /srv/www/html/srv_demo/demo_inetd log_on_failure += USERID log_on_success += PID HOST EXIT } EOF
% sudo tee -a /etc/inetd.conf << EOF demo_swi_srv stream tcp nowait nobody /srv/www/html/srv_demo/demo_inetd EOF
/etc/services
demo_swi_srv 8080/tcp
% sudo /etc/init.d/xinetd reload
or
% sudo /etc/init.d/inetd reload