When you load the page with the applet the following screen will appear:
here you can choose the physical locality with which you'll connect to the Net server. The Net server address (and port) should be left unchanged (due to applet security restrictions, you can only connect to the same server the applet comes from, unless you choose a different security policy). Then you can press login, and you'll enter the Net server; it might take a while to establish the connection, and you will see messages in the System Messages area. If the connection is established a new window will pop up:
This is the typical KlavaNode window:
There are two processes running in the node in this example:
AppletTestProcess reads from the keyboard the locality (peer) with which we want to communicate, and then enters a while loop (until string QUIT is entered) and sends every input string (in(!string)@keyb) to the remote locality (out(string)@peer):
rec AppletTestProcess declare locname screen, keyb ; var peer : loc ; var string : str ; var again : bool begin out( "Insert the locality to communicate with\n" )@screen ; in( !peer )@keyb ; out( "You chose: ", peer )@screen ; out( "Insert a string to send to ", peer )@screen ; out( "or QUIT to terminate\n" )@screen ; again := true ; while again do in( !string )@keyb ; if string = "QUIT" then again := false else out( string )@peer endif enddo ; out( "Thank you, BYE BYE\n" )@screen end
ReceiverProcess continously extracts strings from the local tuple space (in(!string)@self) and shows them on the local screen (out(string)@screen)
rec ReceiverProcess declare locname screen, keyb ; var peer : loc ; var string : str ; var again : bool begin while true do in( !string )@self ; out( "RECEIVER : " )@screen ; out( string )@screen ; out( "\n" )@screen enddo end
You may test this example by choosing to communicate with the same locality you connected to the Net, or by opening another browser window, launching another applet and login with another locality.
In the xxx_keyb text area you have to insert the name of the locality you want to communicate with, specifying that the string you entered is of type loc: i.e. if you want to communicate with locality foo you have to insert foo:loc. And then press ENTER or click on the OK button. Then you can start typing strings on the same textarea (if no type is specified, string is assumed) and press enter when you want to deliver that string (ESC or Cancel button will erase the current content of the textarea); when you are done you have to type string QUIT.
You can disconnect from the Net by:
Note that both screen and keyb are logical locality, mapped to the right physical locality by the environment (see the picture of the node above).
You may want to take a look at KlavaAppletTest.java and at the xklaim compiler generated files for the processes above: AppletTestProcess.java and ReceiverProcess.java.
Now you may want to try this applet (note that you need a Java 1.1.x enabled browser; Netscape 4.5 and Internet Explorer 5 should work fine; we had some problems with Internet Explorer 4):
please alway refer to this page to access the applet, whose place is likely to change in the future.
Send any bug to firstname.lastname@example.org
Last Update 01/08/2003