There is a client/server example in JAL addons. Пт, 12 апр 2013, Greg Borota писал(а): > One of the first network programs we had to write in school was a program > that read/wrote to a socket. It's trivial to just do it in any language as > a wrapper around j library. Was wondering there was something in there > already that works just by passing some command line to jconsole. Probably > not, I'll write it. > > > On Fri, Apr 12, 2013 at 8:55 AM, <[email protected]> wrote: > > > 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm
-- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
