Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 2fc07611b08d4a735fd34d5eb60d8e16 > files > 2108

ciao-1.10p8-3mdv2010.0.i586.rpm

<HTML>
<HEAD>
<!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 -->

<LINK rel="stylesheet" href="ciao.css" type="text/css">
<TITLE>The Ciao Prolog System               - Low-level Prolog to Java socket connection</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_159.html">previous</A>, <A HREF="ciao_161.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC673" HREF="ciao_toc.html#TOC673">Low-level Prolog to Java socket connection</A></H1>
<P>
<A NAME="IDX7570"></A>


<P>
<STRONG>Author(s):</STRONG> Jes&uacute;s Correas.


<P>
<STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST)


<P>
<STRONG>Version of last change:</STRONG> 1.9#66 (2003/3/14, 12:48:24 CET)


<P>
 


<P>
<A NAME="IDX7571"></A>
<A NAME="IDX7572"></A>
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 
<A NAME="IDX7573"></A>
<CODE>javart</CODE> (Prolog to Java interface) or 
<A NAME="IDX7574"></A>
<CODE>jtopl</CODE> (Java to Prolog interface) libraries instead. 



<UL>
<LI><A HREF="ciao_160.html#SEC674">Usage and interface (javasock)</A>
<LI><A HREF="ciao_160.html#SEC675">Documentation on exports (javasock)</A>
</UL>



<H2><A NAME="SEC674" HREF="ciao_toc.html#TOC674">Usage and interface (<CODE>javasock</CODE>)</A></H2>

<div class="cartouche">

<UL>

<LI><STRONG>Library usage:</STRONG>

<CODE>:- use_module(library(javasock)).</CODE>

<LI><STRONG>Exports:</STRONG>


<UL>

<LI><EM>Predicates:</EM>

<A NAME="IDX7575"></A>
<CODE>bind_socket_interface/1</CODE>, 
<A NAME="IDX7576"></A>
<CODE>start_socket_interface/2</CODE>, 
<A NAME="IDX7577"></A>
<CODE>stop_socket_interface/0</CODE>, 
<A NAME="IDX7578"></A>
<CODE>join_socket_interface/0</CODE>, 
<A NAME="IDX7579"></A>
<CODE>java_query/2</CODE>, 
<A NAME="IDX7580"></A>
<CODE>java_response/2</CODE>, 
<A NAME="IDX7581"></A>
<CODE>prolog_query/2</CODE>, 
<A NAME="IDX7582"></A>
<CODE>prolog_response/2</CODE>, 
<A NAME="IDX7583"></A>
<CODE>is_connected_to_java/0</CODE>, 
<A NAME="IDX7584"></A>
<CODE>java_debug/1</CODE>, 
<A NAME="IDX7585"></A>
<CODE>java_debug_redo/1</CODE>, 
<A NAME="IDX7586"></A>
<CODE>start_threads/0</CODE>.

</UL>

<LI><STRONG>Other modules used:</STRONG>


<UL>

<LI><EM>System library modules:</EM>

<A NAME="IDX7587"></A>
<CODE>fastrw</CODE>, 
<A NAME="IDX7588"></A>
<CODE>read</CODE>, 
<A NAME="IDX7589"></A>
<CODE>sockets/sockets</CODE>, 
<A NAME="IDX7590"></A>
<CODE>dynamic</CODE>, 
<A NAME="IDX7591"></A>
<CODE>format</CODE>, 
<A NAME="IDX7592"></A>
<CODE>concurrency/concurrency</CODE>, 
<A NAME="IDX7593"></A>
<CODE>javall/jtopl</CODE>, 
<A NAME="IDX7594"></A>
<CODE>sockets/sockets_io</CODE>.

</UL>

</UL>

</div class="cartouche">



<H2><A NAME="SEC675" HREF="ciao_toc.html#TOC675">Documentation on exports (<CODE>javasock</CODE>)</A></H2>
<P>
<A NAME="IDX7595"></A>
<A NAME="IDX7596"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>bind_socket_interface/1:</B>
<DD><A NAME="IDX7597"></A>


<P>
<STRONG>Usage:</STRONG> <CODE>bind_socket_interface(+Port)</CODE>

<UL>
<LI><EM>Description:</EM> 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.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>+Port</CODE> is an integer.
 (<CODE>basic_props:int/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7598"></A>
<A NAME="IDX7599"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>start_socket_interface/2:</B>
<DD><A NAME="IDX7600"></A>


<P>
<STRONG>Usage:</STRONG> <CODE>start_socket_interface(+Address, +Stream)</CODE>

<UL>
<LI><EM>Description:</EM> 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.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>+Address</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)

<CODE>+Stream</CODE> is an open stream.
 (<CODE>streams_basic:stream/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7601"></A>
<A NAME="IDX7602"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>stop_socket_interface/0:</B>
<DD><A NAME="IDX7603"></A>


<P>
<STRONG>Usage:</STRONG> 

<UL>
<LI><EM>Description:</EM> Closes the sockets to disconnect from the java process, and waits until the threads that handle the connection terminate.

</UL>

</DL>

<P>
<A NAME="IDX7604"></A>
<A NAME="IDX7605"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>join_socket_interface/0:</B>
<DD><A NAME="IDX7606"></A>


<P>
<STRONG>Usage:</STRONG> 

<UL>
<LI><EM>Description:</EM> Waits until the threads that handle the connection terminate.

</UL>

</DL>

<P>
<A NAME="IDX7607"></A>
<A NAME="IDX7608"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>java_query/2:</B>
<DD><A NAME="IDX7609"></A>


<P>
The predicate is of type <EM>concurrent</EM>.


<P>
<STRONG>Usage:</STRONG> <CODE>java_query(ThreadId, Query)</CODE>

<UL>
<LI><EM>Description:</EM> 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.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>ThreadId</CODE> is an atom.
 (<CODE>basic_props:atm/1</CODE>)

<CODE>Query</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7610"></A>
<A NAME="IDX7611"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>java_response/2:</B>
<DD><A NAME="IDX7612"></A>


<P>
The predicate is of type <EM>concurrent</EM>.


<P>
<STRONG>Usage:</STRONG> <CODE>java_response(Id, Response)</CODE>

<UL>
<LI><EM>Description:</EM> 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.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>Id</CODE> is an atom.
 (<CODE>basic_props:atm/1</CODE>)

<CODE>Response</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7613"></A>
<A NAME="IDX7614"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>prolog_query/2:</B>
<DD><A NAME="IDX7615"></A>


<P>
The predicate is of type <EM>concurrent</EM>.


<P>
<STRONG>Usage:</STRONG> <CODE>prolog_query(Id, Query)</CODE>

<UL>
<LI><EM>Description:</EM> Data predicate that keeps a queue of the queries requested to Prolog side from Java side.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>Id</CODE> is an integer.
 (<CODE>basic_props:int/1</CODE>)

<CODE>Query</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7616"></A>
<A NAME="IDX7617"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>prolog_response/2:</B>
<DD><A NAME="IDX7618"></A>


<P>
The predicate is of type <EM>concurrent</EM>.


<P>
<STRONG>Usage:</STRONG> <CODE>prolog_response(Id, Response)</CODE>

<UL>
<LI><EM>Description:</EM> Data predicate that keeps a queue of the responses to queries requested to Prolog side from Java side.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>Id</CODE> is an integer.
 (<CODE>basic_props:int/1</CODE>)

<CODE>Response</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX7619"></A>
<A NAME="IDX7620"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>is_connected_to_java/0:</B>
<DD><A NAME="IDX7621"></A>


<P>
<STRONG>Usage:</STRONG> 

<UL>
<LI><EM>Description:</EM> Checks if the connection to Java is established.

</UL>

</DL>

<P>
<A NAME="IDX7622"></A>
<A NAME="IDX7623"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>java_debug/1:</B>
<DD><A NAME="IDX7624"></A>


<P>
No further documentation available for this predicate.


</DL>

<P>
<A NAME="IDX7625"></A>
<A NAME="IDX7626"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>java_debug_redo/1:</B>
<DD><A NAME="IDX7627"></A>


<P>
No further documentation available for this predicate.


</DL>

<P>
<A NAME="IDX7628"></A>
<A NAME="IDX7629"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>start_threads/0:</B>
<DD><A NAME="IDX7630"></A>


<P>
<STRONG>Usage:</STRONG> 

<UL>
<LI><EM>Description:</EM> 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.

</UL>

</DL>

<P><HR><P>
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_159.html">previous</A>, <A HREF="ciao_161.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
</BODY>
</HTML>