Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 13:32:01 +0000



Post From: DTC client implementation in C#-some pointers needed

[2014-02-12 19:38:32]
User57650 - Posts: 50
Hello,
I am trying to implement a DTC client in .Net that would receive market data from your Relay Server. It should be fairly easy to establish a socket connection to your Relay Server and start sending/receiving messages. In pseudo code, I would just use

Socket.BeginReceive(
  byte[] buffer,
  int offset,
  int size,
  SocketFlags socketFlags,
  AsyncCallback callback,
  Object state
)

and process received buffer data in a callback method.

One thing I am not certain about is how to properly read in the received bytes. Will that byte array (buffer) be filled with bytes based on respective message types defined in DTC protocol? How will I know I am at the beginning of a message? Based on my understanding, each message structure has Size and Type at its beginning, so I could technically use that information to read off remaining bytes from the array. This would assume that whatever message I receive is GUARANTEED to have size/type at the start of it and that I will receive a complete message. I would then also have to make a conversion of the received bytes for each particular C++ variable type in the structure to a corresponding type in C#. Similarly, using the above logic I could send messages by populating a byte buffer with appropriate bytes that would comprise a given message structure in DTC protocol and then send it over the socket.


Is this roughly how I should try to go about this? Thank you for assistance.