Greg Borota wrote:
> In q/k language you can start the interpreter like this:
> $ q -p 5001
Think Unix and combine jconsole with a tool that knows how
to interconnect stdin/stdout with TCP/IP.
For example, use "netcat":
$ nc -l -p 5001 -c jconsole
To connect interactively to the interpreter, you can use netcat ("nc"),
too.
socket(1) is an older, netcat-like tool (I actually prefer this).
For an interactive client, telnet(1) will do, too. You'll have to
adopt for the line endings, though. This can be done either at the
nc/socket server side or by "toggle outbinary" at the telnet client.
For auto-running a J as a service, just use inetd(8):
On miles.marshlabs.gaertner.de (OLD FreeBSD 4.7, dual-stacked IPv4 & IPv6):
neitzel 107 > grep -w ^j /etc/services
j 5001/tcp #j language.
neitzel 108 > grep -w ^j /etc/inetd.conf
j stream tcp nowait nobody /usr/local/bin/jconsole jconsole
j stream tcp6 nowait nobody /usr/local/bin/jconsole jconsole
On another host:
$ telnet miles.marshlabs.gaertner.de 5001
Trying 2a00:1030:1004:1000::166...
Connected to miles.marshlabs.gaertner.de.
Escape character is '^]'.
i. 3 2 4
i. 3 2 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
exit 0
exit 0
Connection closed by foreign host.
$
Note that different releases of J handle I/O differently. This
refers to if your input is echoed back (as above, J Rel. 4),
when your output is flushed, or how line-ends are treated.
(And don't get me started about the J startup scripts....)
miles.marshlabs.gaertner.de is not running 24/7, but feel free to
probe it with a ping and, if it answered, connect to port 5001.
I'll disable the service again in May.
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm