Low-level Prolog to Java socket connection

Author(s): Jesús Correas.

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.


Documentation on exports

PREDICATE

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:
    (basic_props:int/1)Port is an integer.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Port is currently a term which is not a free variable.

PREDICATE

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:
    (basic_props:term/1)Address is any term.
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)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.

PREDICATE

Usage:

  • Description: Closes the sockets to disconnect from the java process, and waits until the threads that handle the connection terminate.

PREDICATE

Usage:

  • Description: Waits until the threads that handle the connection terminate.

PREDICATE

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:
    (basic_props:atm/1)ThreadId is an atom.
    (basic_props:term/1)Query is any term.

PREDICATE

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:
    (basic_props:atm/1)Id is an atom.
    (basic_props:term/1)Response is any term.

PREDICATE

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:
    (basic_props:int/1)Id is an integer.
    (basic_props:term/1)Query is any term.

PREDICATE

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:
    (basic_props:int/1)Id is an integer.
    (basic_props:term/1)Response is any term.

PREDICATE

Usage:

  • Description: Checks if the connection to Java is established.

PREDICATE
No further documentation available for this predicate.

PREDICATE
No further documentation available for this predicate.

PREDICATE

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.