Login Page - Create Account

DTC Protocol Discussion Forum


Date/Time: Thu, 24 Sep 2020 01:23:59 +0000


Post From: DTC with JSON encoding

[2017-12-22 15:06:03]
Jose - Posts: 4 | Ending Date: 2018-01-04 [Expired]
Hello,

Please help me because in the past two days I tried to solve JSON communication (from .NET C#) with DTC but in this moment I feel myself in an infinitive circle.

In SierraChart I set the DTC server encoding to JSON (with authorization is not required).
Related to this "Connection and Logon Sequence" description:
(https://www.sierrachart.com/index.php?page=doc/DTCMessageDocumentation.php#ConnectionLogon)
"If the Client knows the default encoding used by the Server, then it does not need to send an ENCODING_REQUEST message to the Server but it is preferred."
...for me it means I can skip the encoding part and I can step forward (to the point 3.)) to the LOGON_REQUEST.

My LOGON_REQUEST JSON text is this:
{"Type":1,"HeartbeatIntervalInSeconds":5,"TradeMode":1,"ClientName":"Jose"}
Is it okay or something is missing from it?

Originally .NET framework has the "Encoding.BigEndianUnicode" support but the DTC server is waiting for the message in "LittleEndian" encoding. I have found some interesting articles in this topic and if I understand well the differences between LittleEndian and BigEndian depends on my hardware. I have checked my computer architecture and that is LittleEndian (https://msdn.microsoft.com/en-us/library/system.bitconverter.islittleendian.aspx). ...so I think my message encoding is correct.

I sent all JSON messages with this encoding but however anything what I sent to DTC server then I got this error message:
DTC client #1. 127.0.0.1 | Received message with an invalid size (1). | 2017-12-22 14:12:06 *
Can you help me what am I doing wrong?

Thanks in advance!
Jose