Hello all,
I've created a DataReader, DataWriter and topic with all default QOS policies.
I'm continually publishing data, but the DataReader keeps on receiving only the
first message published. I'm using the code shown below to read messages:
result = hello_reader->take (hello_dataList, infoList, LENGTH_UNLIMITED,
NOT_READ_SAMPLE_STATE, ANY_VIEW_STATE, ALIVE_INSTANCE_STATE);
I've changed this from the default to notice a difference. The default was:
result = hello_reader->take (hello_dataList, infoList, 1, ANY_SAMPLE_STATE,
ANY_VIEW_STATE, ANY_INSTANCE_STATE);
This did not give any other result. My question is: how do I read messages only
once, and move up in the queue of available messages? (the relevant sample of
the code is shown at the end of the message)
Greetings,
Pepijn
- Sample code -
while (!terminate) {
ConditionSeq_var conditionList = new ConditionSeq();
result = w.wait (conditionList.inout (), DURATION_INFINITE);
if (result == DDS::RETCODE_ALREADY_DELETED) {
terminate = TRUE;
continue;
}
int imax = conditionList->length ();
for (int i = 0; i < imax; i++) {
if (conditionList[i].in() == hello_status) {
result = hello_reader->take (hello_dataList, infoList, 1,
ANY_SAMPLE_STATE, ANY_VIEW_STATE, ANY_INSTANCE_STATE);
int jmax = hello_dataList->length ();
if (jmax != 0) {
for (int j = 0; j < jmax; j++) {
if (infoList[j].valid_data) {
HelloTopicType ht = hello_dataList[j];
cout << ht.message << endl; // The exact
same message keeps on being published again and again
}
}
}
} else {
cout << "unknown condition triggered: " << conditionList[i].in()
<< endl;
}
}
_______________________________________________
OpenSplice DDS Developer Mailing List
[email protected]
Subscribe / Unsubscribe http://dev.opensplice.org/mailman/listinfo/developer