Two things are required to run any sockets program from Prolog:
The samples:
The simplest program to finger a host. If you are running under Unix you will need to change the sdefine/2 declaration at the top and comment out the Windows calls (wsaStartup and wsaCleanup).
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. If you are running under Unix you will need to change the sdefine/2 declaration at the top and comment out the Windows calls (wsaStartup and wsaCleanup).
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 crtl-C/break
out of the server.