mathpaquette / IQFeed.CSharpApiClient

IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
MIT License
120 stars 43 forks source link

Exception happens on ReqWatchList call #87

Open sharok opened 4 years ago

sharok commented 4 years ago

Calling ReqWatchList produces exceptions:

Unhandled exception. [System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
   at System.IO.MemoryStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at IQFeed.CSharpApiClient.Socket.SocketMessageHandler.TryRead(Byte[]& output) 

It happens when there are a lot of symbols. I tried 1300 options symbols. After some debugging, I figured out that the size of the buffer is not enough.

Increasing _readBytes solves the issue, quick fix:

_readBytes = new byte[bufferSize * 3];

mathpaquette commented 4 years ago

@sharok thanks for rising this. could you please refresh my mind on what it does exactly? just returns a list of currently watched symbols?

mathpaquette commented 4 years ago

usually I give the opportunity to increase the buffer size through the factory. Let me add that as well for Level1

sharok commented 4 years ago

@mathpaquette Yes, it just returns watching symbols.