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)

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)

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:

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

    PREDICATE

    Usage:

    Waits until the threads that handle the connection terminate.

      PREDICATE

      Usage:java_query(ThreadId,Query)

      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.
      The predicate is of type concurrent.

      PREDICATE

      Usage:java_response(Id,Response)

      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.
      The predicate is of type concurrent.

      PREDICATE

      Usage:prolog_query(Id,Query)

      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.
      The predicate is of type concurrent.

      PREDICATE

      Usage:prolog_response(Id,Response)

      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.
      The predicate is of type concurrent.

      PREDICATE

      Usage:

      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:

        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.