25 int main(
int argc,
char* argv[])
37 JParser<> zap(
"Example program to distribute data through control host.");
45 catch(
const exception &error) {
46 FATAL(error.what() << endl);
52 if (destinations.empty()) {
53 FATAL(
"Destination is empty" << endl);
57 typedef JSinglePointer< JControlHostObjectOutput<data_type> > pointerHostObject_t;
63 DEBUG(
"Connection " << *i <<
' ' << flush);
67 output.push_back(
new JControlHostObjectOutput<data_type>(*i));
69 i = destinations.erase(i);
73 catch(
const exception& error) {
79 if (i == destinations.end()) {
81 i = destinations.begin();
89 JControlHostObjectIterator<data_type> in(hostname);
91 while (in.hasNext()) {
93 data_type* p = in.next();
95 DEBUG(
"I got data " << endl);
101 catch(
const exception& error) {
102 ERROR(error.what() << endl);
103 out = output.erase(out);
106 if (out == output.end()) {
107 out = output.begin();
111 catch(
const exception& error) {
112 ERROR(error.what() << endl);