| Line | |
|---|
| 1 | #include "MessageDim.h"
|
|---|
| 2 |
|
|---|
| 3 | #include "tools.h"
|
|---|
| 4 |
|
|---|
| 5 | #include <iostream>
|
|---|
| 6 |
|
|---|
| 7 | int main(int, const char **argv)
|
|---|
| 8 | {
|
|---|
| 9 | // We could use putenv to make the Configure class change the value...
|
|---|
| 10 | setenv("DIM_DNS_NODE", "localhost", 0);
|
|---|
| 11 |
|
|---|
| 12 | // Get the name of the server we should subscribe to from the cmd line
|
|---|
| 13 | const std::string server = argv[1] ? argv[1] : "TIME";
|
|---|
| 14 |
|
|---|
| 15 | // Some info on the console
|
|---|
| 16 | std::cout << "Subscribing to " << server << "/MESSAGE...\n" << std::endl;
|
|---|
| 17 |
|
|---|
| 18 | // Create a message handler (default: redirects to stdout)
|
|---|
| 19 | MessageImp msg;
|
|---|
| 20 |
|
|---|
| 21 | // Subscribe to SERVER/MESSAGE and start output
|
|---|
| 22 | MessageDimRX msgrx(server, msg);
|
|---|
| 23 |
|
|---|
| 24 | // Just do nothing ;)
|
|---|
| 25 | while (1)
|
|---|
| 26 | usleep(1);
|
|---|
| 27 |
|
|---|
| 28 | return 0;
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | // **************************************************************************
|
|---|
| 32 | /** @example log.cc
|
|---|
| 33 |
|
|---|
| 34 | This is a simple example which subscribes to the message service of one
|
|---|
| 35 | dedicated dim client. It can be used to remotely log its log-messages.
|
|---|
| 36 |
|
|---|
| 37 | To redirect the output to a file use the shell redirection or the
|
|---|
| 38 | tee-program.
|
|---|
| 39 |
|
|---|
| 40 | The program is stopped by CTRL-C
|
|---|
| 41 |
|
|---|
| 42 | */
|
|---|
| 43 | // **************************************************************************
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.