Jump to content
Sign in to follow this  

Update Error with Lightstreamer Net Client on DefaultPrices

Recommended Posts

Hi guys, I want to report a problem I’ve seen with the Lightstreamer Net client when I was trying to get the “DefaultPrices” using an ExtendedTableInfo object. Let me say that there is a simple work around it (using a SimpleTableInfo) but I think it still worth listing the problem on here as it can be useful to other people (and as you can see in this post, I’m not the only one who has run into it).

Note that the CIAPI.cs implements the SimpleTableInfo, so everyone using CIAPI.cs will be fine.

The problem I’ve got is that I can only get the first set of data (for the EUR/USD market), and the lightstreamer .Net Client throws a PushServerException (with Wrong Item Number as message) for the 7 other sets of market data returned.

Error in received values Lightstreamer.DotNet.Client.PushServerException: Wrong item number
   at Lightstreamer.DotNet.Client.FullTableManager.ProcessUpdate(ServerUpdateEvent values, Int32 itemPos, Int32 itemIndex) in c:\LIGHTSTREAMER\PROJECT_Lightstreamer_3_DotNetClient_1\DotNetClient\Source\FullTableManager.cs:line 234
   at Lightstreamer.DotNet.Client.FullTableManager.DoUpdate(ServerUpdateEvent values) in c:\LIGHTSTREAMER\PROJECT_Lightstreamer_3_DotNetClient_1\DotNetClient\Source\FullTableManager.cs:line 214
   at Lightstreamer.DotNet.Client.MyServerListener.OnUpdate(ITableManager table, ServerUpdateEvent values) in c:\LIGHTSTREAMER\PROJECT_Lightstreamer_3_DotNetClient_1\DotNetClient\Source\MyServerListener.cs:line 75

Using Fiddler, I can see that 8 sets of data have been sent from the server to the client, but for some reason the client cannot retrieve anythng else than the first set (MarketId = 400494226)




I’m not expecting any resolution of this issue (not sure if it’s not a bug with the Lighstreamer Net client), but if someone is interrested to reproduce, here is a very small code sample that I’ve put together (just copy the snippet into the program.cs of a VS Console app and make sure you add a reference to the lightstreamer DotNetClient_N2.dll assembly).

To make this code works, comment out the use of ExtendedTableInfo and uncomment the following lines to use SimpleTableInfo.

using System;
using Lightstreamer.DotNet.Client;

class Program
    static void Main()
        var lsClient = new LSClient();
        var connectionInfo = new ConnectionInfo
                                     PushServerUrl = "https://pushpreprod.cityindextest9.co.uk",
                                     Adapter = "CITYINDEXSTREAMINGDEFAULTPRICES"
        lsClient.OpenConnection(connectionInfo, new MyConnectionListener());

        var tableInfo = new ExtendedTableInfo(new[] { "AC2347" },
                                              new[] {"MarketId", "TickDate", "Bid", "Offer", "Price", "High",
                                                          "Low", "Change", "Direction", "AuditId"},
        //var tableInfo = new SimpleTableInfo("AC2347",
        //                                    "MERGE",
        //                                    "MarketId TickDate Bid Offer Price High Low Change Direction AuditId",
        //                                    true);
        tableInfo.DataAdapter = "PRICES";

        SubscribedTableKey tableKey = null;
            tableKey = lsClient.SubscribeTable(tableInfo, new MyTableListener(), false);

            Console.WriteLine("Press a key to quit...");
        catch (Exception ex)
            Console.WriteLine("Exception: {0}", ex);

    class MyConnectionListener : IConnectionListener
        public void OnDataError(PushServerException ex)
            Console.WriteLine("Exception: {0}", ex);
        public void OnFailure(PushServerException ex) { }
        public void OnFailure(PushConnException ex) { }
        public void OnConnectionEstablished() { }
        public void OnSessionStarted(bool isPolling) { }
        public void OnNewBytes(long bytes) { }
        public void OnActivityWarning(bool warningOn) { }
        public void OnClose() { }
        public void OnEnd(int cause) { }

    class MyTableListener : IHandyTableListener
        public void OnUpdate(int itemPos, string itemName, IUpdateInfo update)
            Console.WriteLine("\nMyTableListener.OnUpdate - ItemPos:{0} - itemName:{1}", itemPos, itemName);
            for (int index = 1; index < update.NumFields + 1; index++)
                Console.WriteLine("oldValue:{0} -> newValue:{1}", update.GetOldValue(index), update.GetNewValue(index));
        public void OnSnapshotEnd(int itemPos, string itemName) { }
        public void OnRawUpdatesLost(int itemPos, string itemName, int lostUpdates) { }
        public void OnUnsubscr(int itemPos, string itemName) { }
        public void OnUnsubscrAll() { }

Share this post

Link to post
Guest mrdavidlaing

Thanks for the pointers. We recommend that you don’t use the ExtendedTableInfo.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this