question

Upvotes
Accepted
34 6 11 17

rsslEncodeMsgInit

How do I handle -21 error on rsslEncodeFieldListInit. This error is buffer too small. Are there any functionalities that I ca use to handle this error?

elektronelektron-sdkrrteta-apielektron-transport-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@vishal.anand

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvote
Accepted
79.2k 251 52 74

@vishal.anand

First, you need to call the rsslEncodeFieldListComplete method with RSSL_FALSE in the success parameter to roll back encoding to the last successfully encoded point in the contents.

retCode = rsslEncodeFieldListComplete(encIter, RSSL_FALSE );

Then, get a new larger buffer. After that, you can use the rsslRealignEncodeIteratorBuffer to dynamically associate a new, larger buffer with the encoding process, allowing encoding to continue.

//newBuffer contains a new larger 
bufferretVal = rsslRealignEncodeIteratorBuffer(encIter, &newBuffer); 
retCode = rsslEncodeFieldListInit(encIter, &_rsslFieldList, 0, 0 );

Moreover, if the old buffer is retrieved from the rsslGetBuffer method, you need to call the rsslReleaseBuffer method to release the old buffer back to the transport's pool.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.