>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

J Server and Telnet (jserver and jtelnet) classes

The jserver class allows you to create and manage a separate J task as a server. jserver.ijs (open 'jserver') defines a jserver class that uses the J Engine Protocol to create and manage a J Engine server. This class works in both Jconsole and Jwd. It starts a new J task, either on the local machine or a remote machine, and controls that task with the J Engine Protocol.You can take advantage of multiple processors on the same host, remote hosts, and build applications where the interactive GUI runs in one JE and the data processing is done in others as appropriate. For example:
   require'jserver'
   js=: conew'jserver'     NB. create new jserver object
   local__js''                  NB. create J server task
   run__js'abc=: i.2 3 4' NB. run sentence in server task
   d=: get__js'abc'         NB. get value from J server task
   destroy__js''              NB. destroy object and free resources

The jserver class also supports J server tasks running on on other machines. It uses jtelent to start the J server on the remote machine. If you had J installed on another machine that was accessible to you from telnet you could start and use a J server on that remote machine. For example, if your other machine is called Frodo and you have a user id of Bilbo and a password of Baggins, you could try the following:

   require'jserver'
   js=.conew'jserver'
   NB. start J server on remote machine
   remote__js'Frodo Bilbo Baggins 0'
   NB. run sentence on remote server
   run__js'abc=:i.2 3 4'
   destroy__js''


remote__js connects with jtelnet to the remote system and runs jepstart with the required parameters. The remote machine must have a jepstart that starts jep with the parameters. For example, on the remote system in a bin directory define a shell script called jepstart:

#!/bin/sh
cd ~/j601
./jep $*

You could use Frodo's IP address (e.g. 192.168.1.5) instead of the name.

The remote jserver uses jtelnet, a simple and naive implementation of the telnet protocol. For example:

   require'jtelnet'
   tn=: conew'jtelnet'      NB. create jtelnet object
   logon__tn'Frodo Bilbo Baggins 0'
   run__tn'ls'
   destroy__tn''


Open and study the scripts for more information and ideas on their use.


>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User