FirstSteps » History » Version 6

Anonymous, 10/18/2011 10:39 AM
Table of Contents

1 1 J. Moringen
h1. First Steps
2 1 J. Moringen
3 6 Anonymous
{{>toc}}
4 6 Anonymous
5 1 J. Moringen
h2. Introduction
6 1 J. Moringen
7 1 J. Moringen
After having installed RSB, trying some of the included example programs and generally making sure everything works as it should may be a good next step. This page describes some initial experiments that can be carried out after installing RSB.
8 1 J. Moringen
9 1 J. Moringen
h2. Starting RSB Programs
10 1 J. Moringen
11 4 Anonymous
Currently, RSB uses "the Spread group communication framework":http://www.spread.org as its default network transport. Spread requires a dedicated daemon process to be running on at least one host of the network segment. Installation of the Spread libraries and daemon is explained on the [[Installation|installation page]].
12 1 J. Moringen
13 1 J. Moringen
# Starting the Spread daemon
14 1 J. Moringen
If only a single machine is involved, the Spread daemon can be started using the following command:
15 1 J. Moringen
<pre>
16 1 J. Moringen
$ /SPREAD_INSTALL_PREFIX/sbin/spread -n localhost
17 1 J. Moringen
/===========================================================================\
18 1 J. Moringen
| The Spread Toolkit.                                                       |
19 1 J. Moringen
| Copyright (c) 1993-2006 Spread Concepts LLC                               |
20 1 J. Moringen
| All rights reserved.                                                      |
21 1 J. Moringen
[...]
22 1 J. Moringen
</pre>
23 1 J. Moringen
# Starting an RSB Example Program
24 5 J. Moringen
After the Spread daemon is running, connecting to it can be tested using one the example programs. For instance:
25 1 J. Moringen
<pre>
26 1 J. Moringen
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
27 1 J. Moringen
Elapsed time for 1200 messages sent: 0.06 s
28 1 J. Moringen
</pre>
29 1 J. Moringen
If everything goes well, the output should look similar to the above. If the connection to the Spread daemon fails, the output will look similar to the following:
30 1 J. Moringen
<pre>
31 1 J. Moringen
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
32 1 J. Moringen
1311067154364 rsb.spread.SpreadConnection [FATAL]: spread connect error: connection to spread daemon failed due to socket errors
33 1 J. Moringen
SP_error: (-2) Could not connect. Is Spread running?
34 1 J. Moringen
terminate called after throwing an instance of 'rsb::CommException'
35 1 J. Moringen
  what():  Error during connection to spread daemon
36 1 J. Moringen
Aborted
37 1 J. Moringen
</pre>
38 1 J. Moringen
39 1 J. Moringen
h2. Exchanging Events between two Processes
40 1 J. Moringen
41 2 J. Moringen
A more interesting experiment can be conducted by adding a receiving process. The easiest way to do this is using one shell for each process.
42 2 J. Moringen
43 2 J. Moringen
# Starting the Receiving Process
44 2 J. Moringen
<pre>
45 2 J. Moringen
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_listener
46 2 J. Moringen
Listener setup finished. Waiting for messages on scope Scope[/example/informer/]
47 2 J. Moringen
</pre>
48 2 J. Moringen
# Starting the Informer Process
49 3 J. Moringen
Like before:
50 2 J. Moringen
<pre>
51 2 J. Moringen
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
52 2 J. Moringen
Elapsed time for 1200 messages sent: 0.06 s
53 2 J. Moringen
</pre>
54 2 J. Moringen
55 2 J. Moringen
The @rsb_listener@ process should start to print lots of messages like
56 2 J. Moringen
<pre>
57 2 J. Moringen
blub
58 2 J. Moringen
blub
59 2 J. Moringen
[...]
60 2 J. Moringen
</pre>
61 1 J. Moringen
62 1 J. Moringen
h2. Observing Events using the @rsblogger@ Program
63 1 J. Moringen
64 3 J. Moringen
Finally, it may be interesting to observe the actual events as they are sent over the network rather than just the output of the receiving process. This can be achieved using the @rsblogger@ tools. 
65 3 J. Moringen
66 3 J. Moringen
# Starting the @rsblogger@ Process
67 3 J. Moringen
<pre>
68 3 J. Moringen
/RSB_CPP_TOOLS_SOURCE_DIRECTORY/build/logger/rsblogger --format detailed /
69 3 J. Moringen
</pre>
70 3 J. Moringen
*Note that the @rsblogger@ program is located in the @cpp/tools@ sub-project, not the @cpp/core@ sub-project.*
71 3 J. Moringen
# Starting the Informer Process
72 3 J. Moringen
Once again:
73 3 J. Moringen
<pre>
74 3 J. Moringen
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
75 3 J. Moringen
Elapsed time for 1200 messages sent: 0.06 s
76 3 J. Moringen
</pre>
77 3 J. Moringen
78 3 J. Moringen
The @rsblogger@ process should display output like the following:
79 3 J. Moringen
<pre>
80 3 J. Moringen
Event
81 3 J. Moringen
  Scope  /example/informer/
82 3 J. Moringen
  Id     1b043ce7-0294-45a2-80d3-a43703b63986
83 3 J. Moringen
  Type   std::string
84 3 J. Moringen
  Origin a5c937c8-e796-41ba-9c99-e5f2c4b94894
85 3 J. Moringen
Timestamps
86 3 J. Moringen
  Create  2011-Jul-19 11:32:05.425828+??:??
87 3 J. Moringen
  Send    2011-Jul-19 11:32:05.425835+??:??
88 3 J. Moringen
  Receive 2011-Jul-19 11:32:05.441087+??:??
89 3 J. Moringen
  Deliver 2011-Jul-19 11:32:05.441143+??:??
90 3 J. Moringen
Payload (std::string, length 4)
91 3 J. Moringen
  blup
92 3 J. Moringen
</pre>
93 3 J. Moringen
94 3 J. Moringen
Note that it does not matter for this experiment whether there is a receiving process or not. The events will be sent and displayed in any case.
95 1 J. Moringen
96 1 J. Moringen
More information regarding RSB tools can be found on [[Tools|this page]].