Sockets

Tom Howland howland at tc.pw.com
Fri Jul 17 00:34:06 AEST 1998


Ralph Becket wrote

>I was wondering whether anybody is working on adding sockets to the io
>library?  Sockets seem to have a fairly universal interface on most
>platforms.  It would certainly make life easier.  As long as the
>implementors don't pull a Quintus and hide Sockets as God intended
>them behind some dodgy home-grown interface.

I wrote Quintus's library(tcp). And I agree with you that it is "dodgy"
-- except I would have used the word "squirly".

In library(tcp)'s defense: it is widely used and seems well liked. I
think this is because it came with a whole lot of examples, particularly
inter-language examples (C client calling Prolog server, Prolog client
calling C server). It is also very good at reporting errors. I can think
of several commercial applications that are based upon it: IBM's
DataViews (which used a port of library(tcp) to SICStus), SRI's agent
framework, Quintus's CustomerQ, and my current project, EdgarScan.

It does a round robin of available file descriptors. This means that
users can create servers and not have to worry about scheduling.
Unfortunately, I called the predicate that does this "select", which
leads to confusion for programmers familiar with socket programming.

One of the things it did wrong is it rolled up too much functionality in
one package. There should have been a bare-bones interface to sockets, a
package relating to time manipulation, another for binary representation
of terms, and another for scheduling.

Until (if) SICS moves the Quintus documentation to the web, you can
view it at

   http://www.rahul.net/tom/quintus_manual.html

It was one of my first Prolog projects. Before it was released Richard
O'Keefe reviewed it. A lot of his comments were written in the margins
in a monosyllabic, guttural, implosive manner: yech! blah! yuck! gumph!
... If I could do it over again, I would do the sockets interface like
SICStus did.

   http://www.sics.se/isl/sicstus/sicstus_27.html#SEC185

Actually, even that is a little too clever and limiting. I want an
interface to fd_set's, and an unobstructed view of select() where I can
see errors pending and output ready as well as what is provided by both
Quintus and SICStus: input ready.





More information about the users mailing list