Last change
on this file since 14558 was 13838, checked in by tbretz, 13 years ago |
Adapted to the changes in the StateMachineDim. Now (almost) all received services are processed synchronously with the commands and (more important) with the Execute function.
|
File size:
1.4 KB
|
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 |
|
---|
17 |
|
---|
18 | // Some info on the console
|
---|
19 | std::cout << "Offering TIME/MESSAGE...\n" << std::endl;
|
---|
20 |
|
---|
21 | // Setup a DimService called TIME/MESSAGE
|
---|
22 | MessageDimTX msg("TIME");
|
---|
23 | while (1)
|
---|
24 | {
|
---|
25 | // Send current time
|
---|
26 | msg.Message(Time().GetAsStr());
|
---|
27 |
|
---|
28 | // wait approximately one second
|
---|
29 | usleep(1000000);
|
---|
30 |
|
---|
31 | //std::cout << DimServer::getClientName() << std::endl;
|
---|
32 | //std::cout << DimServer::getClientId() << std::endl;
|
---|
33 | //std::cout << DimServer::getDnsPort() << std::endl;
|
---|
34 | std::cout << "con: " << dis_get_conn_id() << std::endl;
|
---|
35 |
|
---|
36 | char **ids = DimServer::getClientServices();
|
---|
37 |
|
---|
38 | while (*ids)
|
---|
39 | {
|
---|
40 | std::cout << *ids << std::endl;
|
---|
41 | ids++;
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | return 0;
|
---|
46 | }
|
---|
47 |
|
---|
48 | // **************************************************************************
|
---|
49 | /** @example logtime.cc
|
---|
50 |
|
---|
51 | This is a simple example how to log messages through the Dim network
|
---|
52 | using MessageDimTX. Here we are offering the time once a second.
|
---|
53 |
|
---|
54 | The program is stopped by CTRL-C
|
---|
55 |
|
---|
56 | */
|
---|
57 | // **************************************************************************
|
---|
Note:
See
TracBrowser
for help on using the repository browser.