Copyright ® (1997-2005) EDMGROUP Pty Ltd - EZY Prolog Reference

main page

EZY Sockets Remote Run

 

EZY Prolog can be used to run Prolog program on remote server and receive results (synchronously). How does it work?

 

EZY Prolog client establishes communication with EZY Prolog server and sends string for the execution. The string format is the same as used in Prolog console. It can contain calls to standard EZY Prolog predicates or already compiled (loaded to memory) EZY Programs.

System allows to pass parameters which will be filled by remote server.

For example:

ezy_socket_remote_run.pro sample executes built-in predicate (date) on server, passes 3 parameters (Year, Month, Day) which server fills in into Result string (Year=2002,Month=8,Day=5).

Programmer can define how remote run processing will be done on server by defining event handler for remote_run(..) message (intercept this message).

If no event handler is defined or event handler fails on this message - system will execute remote program.

Remote Run message can be limited by timer, which is the maximum time in miliseconds system will wait for reply from remote server.

If the waiting time for reply is greater, than defined timeout, EZY Prolog returns value, which indicates this special case: TIMEOUT="expired"

 

Returning results:

EZY Prolog returns results of the remote program as term, formatted into string.

For example, if date(YEAR, MONTH, DAY) was sent to server, 3 integer variables will be packed into the string in form (list of values, separated by comma):

YEAR=2002,MONTH=8,DAY=5

Client event handler receives event remote_reply(..) with formatted string.

Please see ezy_socket_remote_run.pro for more information.

Notes:

To try remote run sample, you need to have server up and running.

Please start EZY Prolog, open and compile ezy_socket_server.pro file and press run to run server.

After that start another instance of the EZY Prolog, open and compile ezy_socket_remote_run.pro sample and follow instructions.

 

 

Copyright © 1997-2003 EDMGROUP (Australia)

Last Updated:

August 5, 2002