Last change
on this file since 12167 was 11983, checked in by tbretz, 13 years ago |
Reverted unintentional last commit.
|
File size:
1004 bytes
|
Line | |
---|
1 | #include "MessageDim.h"
|
---|
2 |
|
---|
3 | #include "tools.h"
|
---|
4 | #include "Time.h"
|
---|
5 |
|
---|
6 | #include <iostream>
|
---|
7 |
|
---|
8 | int main(int, const char **)
|
---|
9 | {
|
---|
10 | // We could use putenv to make the Configure class change the value...
|
---|
11 | setenv("DIM_DNS_NODE", "localhost", 0);
|
---|
12 |
|
---|
13 | // Start a DimServer called TIME
|
---|
14 | DimServer::start("TIME");
|
---|
15 |
|
---|
16 | // Some info on the console
|
---|
17 | std::cout << "Offering TIME/MESSAGE...\n" << std::endl;
|
---|
18 |
|
---|
19 | // Setup a DimService called TIME/MESSAGE
|
---|
20 | MessageDimTX msg("TIME");
|
---|
21 | while (1)
|
---|
22 | {
|
---|
23 | // Send current time
|
---|
24 | msg.Message(Time().GetAsStr());
|
---|
25 |
|
---|
26 | // wait approximately one second
|
---|
27 | usleep(1000000);
|
---|
28 | }
|
---|
29 |
|
---|
30 | return 0;
|
---|
31 | }
|
---|
32 |
|
---|
33 | // **************************************************************************
|
---|
34 | /** @example logtime.cc
|
---|
35 |
|
---|
36 | This is a simple example how to log messages through the Dim network
|
---|
37 | using MessageDimTX. Here we are offering the time once a second.
|
---|
38 |
|
---|
39 | The program is stopped by CTRL-C
|
---|
40 |
|
---|
41 | */
|
---|
42 | // **************************************************************************
|
---|
Note:
See
TracBrowser
for help on using the repository browser.