Chapter 21 Interprocess Communication
ECLiPSe contains built-in predicates that support interprocess communications
Sockets implement bidirectional channels
that can connect multiple processes on different machines
in different networks.
The socket predicates are directly mapped to the system calls
and therefore detailed information can be found in the Unix manuals.
Sockets in general allow a networked communication among many processes,
where each packet sent by one process can be sent to different address.
In order to limit the number of necessary built-in predicates,
ECLiPSe supports only point-to-point communication based
on stream or datagram sockets, or many-to-one communication
based on datagrams.
Broadcasting as well as using one socket to send data
to different addresses is not supported, except that
datagram sockets can be re-connected, so that the same
socket is directed to another address.
Below we describe the basic communication types that are available
Note that the sockets streams in ECLiPSe are buffered like
all other streams, and so it is necessary to flush
the buffer in order to actually send the data to the socket.
This can be done either with the flush/1 predicate
or with the option %b in printf/2, 3.
- The packet boundaries are not of much
interest in Prolog because every Prolog term represents itself
a message with clear boundaries.