A jconsole task becomes a server when the JHS scripts are loaded, configured, and initialized. JHS is configured to serve a port (e.g., 65001), require a user/pass login, etc.
If you have not already created desktop jconsole and JHS launch icons you can do so now.
load'~addons/ide/jhs/installer.ijs' shortcut 0
JHS terms app and page are synonymous and refer to the JHS response to a browser request. In localhost:65001/jijx the jijx is the page requested from the server at ip address localhost on port 65001. The page request is handled by J code in the locale with the same name as the page. A request for localhost:65001/jijx runs verb jev_get_jijx_ to create the response that is returned to the browser.
localhost (usually 127.0.0.1) is the ip address of the local machine.
The lanip is the address of the machine on the local area network. The lanip will be something like 192.168.0.18. Get your lanip address with:
Default config binds port 65001 to requests from any machine. Access with localhost does not require a login. Access with other than localhost (e.g., lanip) requires a login.
Default config has empty USER and PASS and no login will work.
Start JHS server and try the following:
Browse to URL lanip:65001/jijx and you will get a login page. There is no valid USER/PASS so login will fail.
In your localhost JHS session override config and manually set USER/PASS:
USER_jhs_=: 'Brian' PASS_jhs_=: 'foo'
Try the login again with Brian/foo and you should be in the J session.
This is a good first step as it avoids firewall issues.
Once you have done a login, it is not is not required again in the same browser session. Shutting down the browser and restarting it will again require login.
Now try to browse to URL lanip:65001/jijx on another machine and login. You will probably have to deal with firewall issues.
Perhaps best to leave the default config as the config that is run by the JHS icon. That is, leave it at port 65001 with empty USER/PASS.
A custom config can have a different port and provide USER/PASS for login.
Follow these steps to create a new config file:
f=: '~config/65002.cfg' f fcopynew '~addons/ide/jhs/config/jhs.cfg' open f edit: PORT=: 65002 add : USER=: 'Brian' add : PASS=: 'foo' ctrl+s to save new config
Run your new config:
start jconsole load'~addons/ide/jhs/config/65002.cfg'
You may get a warning that jconsole is trying to access a new port and you will need to allow it to continue.
Access this server with localhost:65002/jijx or lanip:65002/jijx.
Tab Prefix to Distinguish JHS Tasks
Running multiple JHS sessions on multiple machines can get can confusing. Which jijx is that?
open'~config/65002.cfg' add : TIPX=: 'A' ctrl+s
Close 65002 server and restart to get the config change.
Browse to localhost:65001/jijx (default config) and then browse to localhost:65002 (65002 config). Verify that you are using different J tasks. Note the A/ prefix in 65002 tabs.
IP Address Configuration
You can configure your machine in various ways to manage the ip address. You can use DHCP (where it might change each time you start the machine), or DNS, or hardwire an address. These details are beyond the scope of this document. For a server that clients want to access in a consistent manner you need to have either a hardwired ip address or a dns that dynamically translates a name to the ip address.
With a hardwired ip address, you might want to edit your client hosts file to provide a mapping from a name to the hardwired ip address. Search web for: hosts file.
Your network configuration might allow access from one machine to another, but likely it will fail because of firewall rules.
The server machine firewall can prevent inbound requests for jconsole and/or for the port. Detailed info on adjusting your firewall settings is beyond the current scope of this document and varies considerably across platforms, admin, etc. If you have network admin, check with them. If you are doing this yourself, search web for: Windows/Linux/Mac inbound firewall rules. Inbound firewall rules can allow the port for any program, or in some cases can allow any port for a particular program. Make the rule as specific as possible.
In Windows go through control panel to windows firewall and proceed carefully.
In Linux/OSX use ufw (man ufw) if possible as it is an easy to use firewall interface.
After adjusting the server firewall to allow the request, try again. If it still fails, check to make sure firewall changes were as required. Be sure other rules aren't overriding the rule you think allowed access.
The client firewall can prevent outbound requests, but this is much less likely. Adjusting outbound firewall rules is similar to adjusting inbound rules. You could disable the server firewall and try again to verify that there is a problem with the client outbound firewall.
[note: adding detailed steps for firewall adjustments for various platforms/environments welcome]
YourApp Instead of jijx
Up to now we have worked with jijx. The ide pages such as jijx are already loaded (or have stubs that will load them when required).
Other apps need to be loaded before you can browse to them.
Browsing to A:P/jdemo1 will fail because jdemo1.ijs has not been loaded to define the jdem01 locale.
You can load the apps you want in your config.
open'~config/any65002.cfg' add line - load'~addons/ide/jhs/demo/jdemo1.ijs' crtl+s
Login required for ide pages such as jijx probably makes sense, but you may want some apps to be available without login required.
Set OKURL to the page(s) you want to allow without login.
open'~config/any65002.cfg' add line - OKURL=: 'jdemo1' NB. or a list '...';'...' ctrl+s
Close the browser completely to discard login for previous pages.
Restart browser and browse to A:P/jdemo1 and this should run without a login.
Browse to A:P/jijx and a login will be required.
65002.cfg Final Version
NB. start JHS - run jconsole and load this (or other cfg) script NB. create other cfg - copy this file, rename, and edit NB. see configdefault_jhs_ for config options config_jhs_=: 3 : 0 NB. add/edit config options here PORT=: 65002 USER=: 'Fred' PASS=: 'abra' TIPX=: 'A' OKURL=: 'jdemo1' load'~addons/ide/jhs/demo/jdemo1.ijs' NB. do not edit after here ) load'~addons/ide/jhs/core.ijs' init_jhs_''
Access from WWW
If your server is on a lan, then the ip address is of the form 192.168.0.18, and is only valid for accessing the server from other machines on the lan. The lan is behind a firewall provided by some other machine (for example, a router) that manages network traffic between the lan and the www.
Machines out in the www can't address your server on the lan directly. Instead www users access a port on the ip address of the router. That ip address gets traffic to the router and then the router forwards it, based on the port, to the appropriate machine in the lan.
The router tracks outgoing messages and automatically routes responses to the correct machine. For a request coming in cold from the www, the router needs configuration information on how to forward the request. You need to configure the router so that a request for a particular port is forwarded to a particular lan ip address. Search for information on how to configure your router or check with you network admin.
Typically you browse to 192.168.0.1 (ip address of the router) and login with the router user/password. You need to find the configuration page for port forwarding and change it so that traffic for your server port is forwarded to your server LAN ip address.
Your external ip address is what a user out in the www would use to access your server that runs in the lan.
Use an ssh service (putty/psftp/sftp/...) to establish a tunnel from the client to the server. Search web for: ssh tunnel.
Set up a tunnel that sends your client machine localhost:65002 requests through the tunnel to the sever machine port 65002. When this is done, you can just browse to localhost:65002/jijx and it will be passed through the tunnel secure connection to the server.
This is the way to go, if possible, for serious applications