Group::write_attribute connection problem
Hello,
The small code below never connect if the server is started after the client. The server is well defined in the DB. No exception is thrown despite the Tango::GroupAttrReply::enable_exception(true);
int main(int argc,char *argv[]) {
Tango::GroupAttrReply::enable_exception(true);
Tango::Group *g1 = new Tango::Group("g1");
g1->add("test/jlp/1");
double iter = 0;
while( true ) {
Tango::DeviceAttribute da1("att_trois",iter);
try {
g1->write_attribute(da1);
} catch(Tango::DevFailed &e) {
cout << e.errors[0].desc << endl;
}
iter++;
sleep(1);
}
}
Possible workaround add a ping() call to make the connection.
int main(int argc,char *argv[]) {
Tango::GroupAttrReply::enable_exception(true);
Tango::Group *g1 = new Tango::Group("g1");
g1->add("test/jlp/1");
double iter = 0;
while( true ) {
Tango::DeviceAttribute da1("att_trois",iter);
try {
g1->ping(); // Make the (re)connection
g1->write_attribute(da1);
} catch(Tango::DevFailed &e) {
cout << e.errors[0].desc << endl;
}
iter++;
sleep(1);
}
}