How to tell if a message is truncate?

Created at 05 Oct 2017, 05:12
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
obaum1@gmail.com's avatar

obaum1@gmail.com

Joined 06.06.2017

How to tell if a message is truncate?
05 Oct 2017, 05:12


Hey Guys?

Can a message be truncate? and if so, how can I tell it from the string message?

** if the "10=" key is missing it means it truncated?

 

Thanks!!!


@obaum1@gmail.com
Replies

PanagiotisCharalampous
05 Oct 2017, 09:16

Hi obaum1@gmail.com,

It could happen but this is a very rare case. However, in any case you detect a truncated message and you need the server to send it again, there is a Resend Request in the FIX API Rules of Engagement.

Best Regards,

Panagiotis


@PanagiotisCharalampous

obaum1@gmail.com
05 Oct 2017, 16:06

Hey :)

Thanks for the Reply.

It's look like it return a truncate message every 5-8 responses when getting the positions at the first* time.
*After you requested the account positions for the first time.

Is this a normal behavior?

Thanks!!!  


@obaum1@gmail.com

PanagiotisCharalampous
05 Oct 2017, 16:19

Hi obaum1@gmail.com,

It is not a normal behavior. Are you sure that the messages are indeed returned truncated? The issue could be caused by the way you are reading and parsing the messages. Can you reproduce this using the example project?

Best Regards,

Panagiotis
 


@PanagiotisCharalampous

obaum1@gmail.com
05 Oct 2017, 23:08

Hey :)

 

Yes I can reproduce this using the example project. 
But now I understand why.. Its happens because the size of the buffer is 1024 which is to small in that case.

Is there a way to get the size of the incoming message before I call SslStream.Read?

Or, should I just set my buffer to be bigger?

Thanks!!


@obaum1@gmail.com

PanagiotisCharalampous
06 Oct 2017, 09:16

Hi obaum1@gmail.com,

I would advise you to put the stream.Read() function in a while loop and continue reading the stream until the function returns 0, which is the number of bytes read.

Best Regards,

Panagiotis


@PanagiotisCharalampous

obaum1@gmail.com
13 Dec 2017, 02:35

Hey Panagiotis,

It doesn't return 0,. and my loop until I get an error ""Unable to read data from the transport connection: A non-blocking socket operation could not be completed immediately"

What can I do?


@obaum1@gmail.com