![]() |
Remote Messaging |
Remote messaging allows one interpreter to send messages to another interpreter even across a network as easily as sending a message to a component in the same interpreter.
In order to do this the following has to be done.
1,Each interpreter has to be given a name using command line parameter,
config.dat file or for applet as applet parameters.
2,The VServer that comes along with the interpreter must be run.
3,The IP address of the VServer must be provided to the interpreter
as command line parameter, using config.dat file or as applet parameter
for applets.
ex:-
java VScript test.txt vsr1 192.168.17.10
Here text.txt is the script file, vsr1 is name given to interpreter and 192.168.17.10 is IP address of server.
This information can be provided in the config.dat file as
vsrname=vsr1
server=192.168.17.10
vscript=test.txt
For Applets
The information can be provided as applet parameter as follows.
<APPLET
code = "VApplet.class"
width = "700"
height = "500"
vscript = "test.txt"
server = "129.168.17.10"
vsrname = "vsr1"
>
</APPLET>
Sending Remote Messages
If interpreter vsr1 must send a message to interpreter vsr2 the script running of vsr1 must do the following.
1,Use the declare tag to tell the interpreter that vsr2 is a remote
interpreter.
Ex:-
<declare>
vsr vsr2,
</declare>
Messages to vsr2 can be send as
vsr2.print(hello vsr2 from vsr1),
Demo
Sample script that can be tried out is given in /samples/remote/ directory.
In order to try out the sample script provided
1, Run the VServer . ex:-
Java VServer
2, Run the remotedemo1.bat
and remotedemo2.bat files or the runvsr1.bat
and runvsr2.bat
files.
In order to understand the messaging process check the demo script given in /samples/remote/ directory.
For testing with applets, run the VServer and then run the remdemo1.html and remdemo2.html files.