Two things are required to run any sockets program from Prolog:
The samples:
The simplest program to finger a host. To run it from the listener:
?- load(asock). yes ?- consult(finger). yes ?- main. Host name to finger? %enter the host name ...
You should see the address echoed and then a request for a login ID, which if you have one, should then lead to some more information.
A simple client/server example, where the clients send lines of text to the server, which echos the text. It can be run on one machine or multiple ones. To run on a single machine, open two consoles and run alis in each.
?- load(asock). yes ?- consult(sserver). yes ?- main.
?- load(asock). yes ?- consult(sclient). yes ?- main. Send what? hello yes ?-
The server should then echo the 'hello'. From the client, type main again and
send the string 'shutdown' to shut down the server. Or you can just cntl-C/break
out of the server.