Long String Length

2 posts / 0 new
Last post
Offline
Last seen: 5 years 8 months ago
Joined: 12/11/2013
Posts: 1
Long String Length

I just have an application which is going to publish very long text using the StringDataWriter class. How can I get rid of the serializable error using only QoS (if possible), without me having to chunk the text before publishing.

I'm totally new to DDS

 

Thank you

Organization:
Gerardo Pardo's picture
Offline
Last seen: 2 days 5 hours ago
Joined: 06/02/2010
Posts: 588

Hi,

How did you define your type in IDL?  If you defined the sting as unbounded (i.e. without an explicit maximum length), then rtiddsgen will automatically assume a maximum length of 255 characters and that will produce an errior if you try to send a longer string.

Assuming this was the situation, you could use the command-lien option -stringSize when you call rtiddsgen to override this maximum limit. But it is better that you make the limit explicit in the IDL as in:

const long MAX_STR_LEN=2048;
struct MyStruct {
    string myString<MAX_STR_LEN>;
    long myLong;
};     

 

In addition, note that if you are trying to send data whose serialized size exceeds the maximum that can be sent over the underlying transport (e.g. UDP), then you need to enable the use of asynchronous publishing.

This forum thread on transport-size messages discusses a similar subject. You may want to take a look at it first.

You may want to take a look at this knowledge-base article explainig how to configure UDP to be able to send up to the underlying maximum of 64KB and configure DDS to write asynchronously.

The FileExchange also has an example on how to send/receive large data.

Gerardo