Go to the first, previous, next, last section, table of contents.
Author(s): Jesús Correas.
Version: 1.11#222 (2004/5/24, 13:8:7 CEST)
Version of last change: 1.9#66 (2003/3/14, 12:48:24 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 interface) or
jtopl
(Java to Prolog interface) libraries instead.
- Library usage:
:- use_module(library(javasock)).
- Exports:
- Predicates:
bind_socket_interface/1
,
start_socket_interface/2
,
stop_socket_interface/0
,
join_socket_interface/0
,
java_query/2
,
java_response/2
,
prolog_query/2
,
prolog_response/2
,
is_connected_to_java/0
,
java_debug/1
,
java_debug_redo/1
,
start_threads/0
.
- Other modules used:
- System library modules:
fastrw
,
read
,
sockets/sockets
,
dynamic
,
format
,
concurrency/concurrency
,
javall/jtopl
,
sockets/sockets_io
.
- PREDICATE: bind_socket_interface/1:
-
Usage: bind_socket_interface(Port)
- Description: Given an port number, waits for a connection request from the Java side, creates the sockets to connect to the java process, and starts the threads needed to handle the connection.
- Call and exit should be compatible with:
Port
is an integer.
(basic_props:int/1
)
- The following properties should hold at call time:
Port
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
- PREDICATE: start_socket_interface/2:
-
Usage: start_socket_interface(Address, Stream)
- Description: Given an address in format 'node:port', creates the sockets to connect to the java process, and starts the threads needed to handle the connection.
- Call and exit should be compatible with:
Address
is any term.
(basic_props:term/1
)
Stream
is an open stream.
(streams_basic:stream/1
)
- The following properties should hold at call time:
Address
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
Stream
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
- PREDICATE: stop_socket_interface/0:
-
Usage:
- Description: Closes the sockets to disconnect from the java process, and waits until the threads that handle the connection terminate.
- PREDICATE: join_socket_interface/0:
-
Usage:
- Description: Waits until the threads that handle the connection terminate.
- PREDICATE: java_query/2:
-
The predicate is of type concurrent.
Usage: java_query(ThreadId, Query)
- Description: Data predicate containing the queries to be sent to Java. First argument is the Prolog thread Id, and second argument is the query to send to Java.
- Call and exit should be compatible with:
ThreadId
is an atom.
(basic_props:atm/1
)
Query
is any term.
(basic_props:term/1
)
- PREDICATE: java_response/2:
-
The predicate is of type concurrent.
Usage: java_response(Id, Response)
- Description: Data predicate that stores the responses to requests received from Java. First argument corresponds to the Prolog thread Id; second argument corresponds to the response itself.
- Call and exit should be compatible with:
Id
is an atom.
(basic_props:atm/1
)
Response
is any term.
(basic_props:term/1
)
- PREDICATE: prolog_query/2:
-
The predicate is of type concurrent.
Usage: prolog_query(Id, Query)
- Description: Data predicate that keeps a queue of the queries requested to Prolog side from Java side.
- Call and exit should be compatible with:
Id
is an integer.
(basic_props:int/1
)
Query
is any term.
(basic_props:term/1
)
- PREDICATE: prolog_response/2:
-
The predicate is of type concurrent.
Usage: prolog_response(Id, Response)
- Description: Data predicate that keeps a queue of the responses to queries requested to Prolog side from Java side.
- Call and exit should be compatible with:
Id
is an integer.
(basic_props:int/1
)
Response
is any term.
(basic_props:term/1
)
- PREDICATE: is_connected_to_java/0:
-
Usage:
- Description: Checks if the connection to Java is established.
- PREDICATE: java_debug/1:
-
No further documentation available for this predicate.
- PREDICATE: java_debug_redo/1:
-
No further documentation available for this predicate.
- PREDICATE: start_threads/0:
-
Usage:
- Description: Starts the threads that will handle the connection to Java. This predicate is declared public for internal purposes, and it is not intended to be used by a user program.
Go to the first, previous, next, last section, table of contents.