Go to the first, previous, next, last section, table of contents.
Author(s): Jesús Correas.
Version: 1.5#118 (2000/4/19, 18:13:43 CEST)
Version of last change: 1.5#49 (2000/2/8, 16:35:38 CET)
This module defines a low level socket interface, to be used by javart and jtopl. Includes all the code related directly to the handling of sockets. This library should not be used by any user program, because is a very low-level connection to Java. Use
javart
(Prolog to Java low-level interface) or
jtopl
(Java to Prolog interface) libraries instead.
- Library usage:
:- use_module(library(javasock)).
- Exports:
- Predicates:
socket_connection/2
,
socket_disconnection/0
,
java_fast_read/2
,
java_fast_write/2
,
java_stream/3
.
- Other modules used:
- System library modules:
fastrw
,
read
,
sockets/sockets
,
dynamic
,
format
.
- PREDICATE: socket_connection/2:
-
Usage: socket_connection(+node,+stream)
- Description: Given a stream connected to a node, it gets the socket port from the given stream and creates the sockets to connect to the java process.
- Call and exit should be compatible with:
+node
is currently instantiated to an atom.
(term_typing:atom/1
)
+stream
is an open stream.
(streams_basic:stream/1
)
- PREDICATE: socket_disconnection/0:
-
Usage:
- Description: It closes the sockets to disconnect from the java process.
- PREDICATE: java_fast_read/2:
-
Usage: java_fast_read(+type,-(term))
- Description: It reads from the given stream type one term and unifies it with the term received as second argument. This is the basic predicate used to receive data from the Java side. The first argument reflects the socket type: event or data. The second argument is unified with the data received from the socket.
- Call and exit should be compatible with:
+type
is currently instantiated to an atom.
(term_typing:atom/1
)
-(term)
is any term.
(basic_props:term/1
)
- PREDICATE: java_fast_write/2:
-
Usage: java_fast_write(+type,+term)
- Description: It writes on the given stream type the term received as second argument. This is the basic predicate used to send data to the Java side. The first argument reflects the socket type: event or data. The second argument is the term to be sent to the Java side.
- Call and exit should be compatible with:
+type
is currently instantiated to an atom.
(term_typing:atom/1
)
+term
is any term.
(basic_props:term/1
)
- PREDICATE: java_stream/3:
-
The predicate is of type dynamic.
Usage: java_stream(DataStream,EventStream,Address)
- Description: Stores the identifiers of the streams used. A fact is asserted when the connection to the Java process is established. It Contains the data and event streams, and the network address where the Java process is running.
- Call and exit should be compatible with:
DataStream
is an atom.
(basic_props:atm/1
)
EventStream
is an integer.
(basic_props:int/1
)
undefined:machine_name(Address)
(undefined property)
Go to the first, previous, next, last section, table of contents.