20{
23
24 string hostname;
25 JTag tag;
26 string message;
27 bool any;
29
30 try {
31
32 JParser<> zap(
"Example program to test communication with JControlHost server.");
33
39
41 }
42 catch(const exception &error) {
44 }
45
46
47 const string pid =
argv[0];
48
49 try {
50
52
54
56
57 if (any) {
59 }
60 else {
62 }
63
65
66 DEBUG(
"Send message: "
67 << "tag <" << tag << "> "
68 <<
"string <" << message <<
">" <<
endl);
69
70 socket.PutFullString(tag, message);
71
72 {
74
76 string buffer;
77
79
80 if (
socket.CheckHead(prefix) > 0) {
81
83 << "time " << i << " us "
84 <<
"tag <" << prefix.
getTag() <<
"> "
86
87
88 socket.GetFullString(buffer);
89
91
93
94 break;
95
96 } else
97
99 }
100
103 }
104 }
105
106
107 {
109
111
112 ControlHost::WhereIs(hostname, pid,
answer);
113
115
116 for (string buffer; is >> buffer; ) {
117
119
121 }
122 }
123
124
125 try {
126
128
130
131 try {
132
133 ControlHost::Throw(true);
134
135 socket.PutFullString(tag[0], message);
136
138 }
140
142
144 }
145
146
148
149 ControlHost::Throw(false);
150
152
154
156 }
159 }
160 }
163 }
164
165 return 0;
166}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
virtual const char * what() const override
Get error message.
int getSize() const
Get size.
std::string toString() const
Convert tag to string.
const JTag & getTag() const
Get tag.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
int getIPnumber(const std::string &host_name)
Get IP number.
std::string getHostname()
Get host name.
Auxiliary class for all subscription.
Auxiliary class for any subscription.