Server

The command server enables multiple input streams. The local command line remains operational.

ser*ver/async*hronous[/mask=ipmask] [port_no]

A socket is opened and a thread accepts connections on the specified port. The default port number is 7777. The default network ipmask is 131.169.255.255. Connections from addresses that do not match are rejected.

Several clients may connect, disconnect and re-connect. The server remains active until it is explicitly closed.

ser*ver/async*hronous/close

Clients receive done, error or some value that has been queried. The function yesno() always returns 0, noyes() always 1.

A client disconnects by sending the string bye.

Be sure to avoid race conditions, i.e. devices that are addressed from different command sources. ONLINE does not detect these conflicts. The last command wins.

/eos_in
The server waits for input until it reads <cr> or <lf>.

/verbose
Enable verbose socket I/O mode.

set verbose/socket on
set verbose/socket off
Enable/disable verbose socket I/O mode.

show/socket
Displays the connections.

Example 1: telnet client
Let's begin with a telnet client which is used for demostrations and debugging purposes only. First the Online session has to start the server. Let's assume it runs on hasexp: ONLINE> server/async
A client connects and queries the current energy: telnet hasexp 7777
* = energy()
bye
The client can re-connect without re-starting the server.

Example 2: ONLINE across the network
An ONLINE session can be run across the network. Again, the first thing to do is starting the server:
ONLINE> server/async
Before the ONLINE client is started, the files exp_ini.exp and online.dev have to be copied from hasexp to some local directory:
mkdir ~/temp
scp hasexp:/online_dir/online.dev ~/temp
scp hasexp:/online_dir/exp_ini.exp ~/temp
online -nnode::7777 -o~/temp

Example 3: C client
An example client which is coded in C can be found in section 14.16.2.

Example 4: Perl client, see 14.16.3.



Subsections