FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Security
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
September 06, 2006

Parameterized Communication

(Page 8 of 8)

How To Program in Obol

Obol scripts tend to follow a similar pattern, but the only real restriction are dependencies; specifically, inputs must be specified by [input] statements before being used. Any mention of "application" refers to the software using the Obol runtime or a particular script.

  1. The header:
    1. Decide which input the script needs, and specify the appropriate [input] metacommands. Remember, the script will not execute non-metacommands unless the application sets all required inputs.
    2. If the script returns any output, specify that with [returns] metacommands.
    3. Decide where the script should look for incoming messages by using the [self] metacommand, which also configures receive modes.
    4. Optionally specify the message representation format to use for constructing messages (also for cryptographic operations), by means of the [format] metacommand,

  2. Initialization of local state. This includes generation of various data, loading keys, and the like.
  3. Constructing and sending the first message, or expecting the first incoming message.
  4. The protocol proper.
  5. Termination. This phase may include setting return values or error messages.

(a)
(script "Server"
   [input portNo number]
   [returns data string]
   [self portNo default   
	   :poolmode]
   [format default]
   (receive *client *data)
   (believe data *data
     ((type string))))
     
     
(b)
(script "Client"
   [input portNo number]
   (believe data 
	      "Hello World!")
   (believe server 
	      "127.0.0.1" 
	      ((port portNo)))
  (send server data))

Here is a "Hello World" type client-server pair showing the aforementioned pattern for (a) server; (b) client.

Previous Page | 1 The Problem | 2 Solution | 3 Benefits | 4 Parameterized Communication | 5 Reflection/Inspection | 6 Conclusion | 7 A Full Protocol Example | 8 How To Program in Obol
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK