TradingAPI_samples IOException every few seconds

Created at 19 Aug 2017, 05:56
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!
CT

ctid320188

Joined 19.04.2017

TradingAPI_samples IOException every few seconds
19 Aug 2017, 05:56


Hi,

I'm trying to work through the example code in TradingAPI_samples. It runs ok for a random few seconds (can be 30 seconds or could be 120 seconds) but keeps throwing exception errors: example:

Listener throws exception: System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at TradingApiTest_CSharp.TradingApiTest.Listen(SslStream sslStream, Queue messagesQueue) in TradingApiTest_CSharp\TradingApiTest.cs:line 91
   at TradingApiTest_CSharp.TradingApiTest.<Main>b__1() in TradingApiTest_CSharp\TradingApiTest.cs:line 211

 

Is there anything I'm doing wrong? This is the code directly from spotware download, I've not modified it. it's not always the Listener thread, it can be one of the other threads too.

I've tried to modify it slightly so it sends a Heartbeat event every 10 seconds but this doesn't seem to fix the issue.

Thanks

Ro


@ctid320188
Replies

Spotware
30 Aug 2017, 15:11

Dear Trader,

This happens because the ping request is disabled in the example project. In order to enable the ping request, please go to TradingApiTest.cs, line 70 and uncomment the SendPingRequest function.

Let us know if this works for you.

Best Regards,

cTrader Team 


@Spotware