PublicShow sourceprolog_server.pl

Source prolog_server(?Port, +Options)
Create a TCP/IP based server on the given Port, so you can telnet into Prolog and run an interactive session. This library is intended to provide access for debugging and management of embedded servers.

Currently defined options are:

allow(IPOrList)
Allow access from IP, a term of the format ip(A,B,C,D), (IPv4) or ip(A, B, C, D, E, F, G, H) (IPv6). Access is granted if the Peer address as returned by tcp_accept/3 unifies with IPOrList or, if IPOrList is a list, with a member of this list. If no allow option is provided access is only granted from ip(127,0,0,1) (localhost).
note Older versions allowed for repeating this option rather than providing a list.

For example:

?- prolog_server(4000, []).

% ncat localhost 4000
Welcome to the SWI-Prolog server on thread client@127.0.0.1

1 ?-
See also
- The add-on libssh provides an embedded SSH server. This provides encryption as well as a pseudo terminal, providing full commandline editing, history and interrupt processing.
bug
- As the connection does not involve a terminal, command history and completion are not provided. Neither are interrupts (Control-C). The Prolog shell can be terminated if netcat shuts down the socket on ^D (using the -N option). Otherwise one must enter the command "end_of_file."