I have initialized a data type dynamically which contains, among various basic types, an octet sequence member which may be up to 100000 elements long. The type registrating code is shown below.
structMembers[...].name = DDS_String_dup("aData");
structMembers[...].type = pTypecodeFactory->create_sequence_tc(100000, pTypecodeFactory->get_primitive_tc(DDS_TK_OCTET), ex);
Now I want to transmit some data over DDS later. The surrounding code looks like this:
DDS_OctetSeq os;
// the char* pData contains the data to send, and nSize is the size of that buffer
os.loan_contiguous((DDS_Octet*) pData, nSize, nSize);
nRetcode = pDdsDynamicDataSample->set_octet_seq("aData", DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED, os);
os.unloan();
// make a DDSDynamicDataWriter and actually send the data
...
This code works and the data does arrive at the intended subscriber, but for some reason whenever the nSize goes above roughly 63 KB the set_octet_seq() call will return DDS_RETCODE_OUT_OF_RESOURCES. Why won't DDS increase the size of the octet sequence over that limit, and where can I change this? Thank you in advance.
This could be an issue with how the DDS_DynamicData is registered / constructed. When you construct the type support it takes a 'properties' argument of type DDS_DynamicDataTypeProperty_t
Within this structure there are settings that control the maximum size of the data storage and the serialization buffer. The default values of these are quite small (64KB) which would explain what you are seeing.
I think what you need is to increase the maximum size to some arge number. For example 1MB. I would not worry that this number is much larger than the 100KB that you need as it will only be allocated to the size that it needs. The maximum size just prevents it from growing beyond that hard limit.
To sum it up you need something along the lines of:
Ah I see, I didn't know that. I will try this solution out. Thank you very much!