basic tools

Basic tools for running and testing SVS networks.

introduction
overview of basic tools

server
configuring and running a server

clients
configuring and running clients

basic SVS client commands
shell commands for SVS client

example exercise
walkthrough example of main shell commands

introduction

Example programs for SVS are found within the 'examples' directory of the download.

SVS is based around a series of networked clients that can provide different services and interfaces. The base classes for these are contained with the svs_core/network module. These are built on top of the Twisted networking library, which can be consulted for detailed information on the underlying networking layer. The clients are organised into cluster groups. A single server can support multiple groups.

page contents

server

A basic SVS system starts off from a server, such as in the server.py example:

#!/usr/bin/env python

from svs_core.network.clustermanager import ClusterManager

# create server
cm = ClusterManager(9797) # <--- set to port number that server will run on

# add clients
cm.addClientAuthentication("harry", "p@ssw0rd")
cm.addClientAuthentication("sally", "p@ssw0rd")

# start server
cm.run()

The server is set to run on port number 9797 and has accounts created to allow 2 clients to connect to it: harry, and sally.

Launch the server with the command:

./server.py

page contents

clients

Clients can be run as command-line only units or with Graphical User Interfaces (GUI). A standard client program contains just a few lines of code:

#!/usr/bin/env python

from svs_core.network.clientuser import GUIClient

cu = GUIClient("sally", "p@ssw0rd")
cu.connect("testgroup", "localhost", 9797)

This connects to a server runnign on the same machine, localhost, operating on port 9797, and connects to a cluster group called testgroup. It can be run from the command:

./sally.py

The clients for harry and sally both use the minimal GUI that is provided by the svs_core/network/clientuser.py module:


fig. 1.) basic GUI for SVS clients.

This provides an input field into which commands can be entered, and text display which logs system messages from the client as well as data received over the network.

The clients support a simple shell language through commands can be used to control clients. Commands are entered into the input field and then executed when the ENTER ot RETURN key is pressed. A list of all commands supported by a client can be founf by entering commands (as shown in fig. 1).

Clients can send messages to one another using the tell command:


fig. 2.) clients chatting.

page contents

basic SVS client commands

These are the commands that can be used from the interactive shell of the SVS client console. See above for information on using the shell.

command definition
commands Get list of script commands.
disconnect Disconnect from server.
quit Disconnect from server and quit client application.
logging Turns log messages on and off.
deposit Deposit data with server-side proxy.
retrieve Collect data from server-side proxy.
cleardeposit Delete data held by server-side proxy.
getfrom Collect data from another client.
put Store data in client-side cache.
get Get data from client-side cache.
clear Delete data from client-side cache.
listen Start/stop listening to another client.
notify Send information to listeners.
tell Sends plain text message to other clients, used for chat.
clearlog Clear text from output console.
echo Turns echo of input in console on and off.
openview Open visualisation in window.*
hideview Hide visualisation in window.*
fullscreen Open fullscreen visualisation.*

table 1.) shell commands.
* - commands not active in all clients

page contents

example exercise

This exercise demonstrates some of the shell commands. Use the scripts in the 'basic_tools' directory inside the 'examples' directory of the svs distribution files. It can be run on one machine or across a network. If running across multiple machines, change the server address in the client files, 'harry.py' and 'sally.py', from "localhost" to the new server address.

step 1.) open a terminal and start the server:

./server.py

step 2.) open a second terminal and start the 'sally' client:

./sally.py

A window should open for the client. When sally connects you should see a message in the server terminal:

CLUSTER MANAGER STATUS MESSAGE: starting server ...
CLUSTER MANAGER STATUS MESSAGE: Client 'sally' connected to server
CLUSTER MANAGER STATUS MESSAGE: Client 'sally' is joining cluster group 'testgroup'

Something like the following should appear in sally's terminal:

connecting to server localhost:9797 ...
connected to server.
data packet received: {'client_name': 'sally', 'client_group': 'testgroup'}
joined cluster group 'testgroup'

step 3.) enter the clearlog command in sally's input field. The output console should clear.

step 4.) enter the commands command in sally's input field. A listing of 'private' and 'public' commands should be printed in sally's output console.

>> commands
'sally' commands:
__public__
  commands
__private__
  clear
  cleardeposit
  clearlog
  deposit
  disconnect
  echo
  fullscreen
  get
  getfrom
  hideview
  listen
  logging
  notify
  openview
  put
  quit
  retrieve
  tell

step 5.) open a third terminal and start the 'harry' client:

./harry.py

page contents