Hi all,
In StockList demo code, it has Random() function to generation stock data. Now I want to replace with my code by read a file to get stock data, after every 5 seconds it read again.


There are my code :
-----------
private void OnTimerEvent(object sender)
{
ISecurityStructReader reader;
reader = new ReadSecurityStruct("C:\\TEMP\\BACKUP08\\SECURITY.D AT");

if (reader.Open())
{
arr = reader.Read();
_stockSymbol = new string[arr.Count];

for (int i=0; i< arr.Count ;i++)
{
Struct_Security item = (Struct_Security)arr[i];
_stockSymbol[i]= item.StockSymbol;
...
}
...
}

--- StockListDemo code, ExternalFeed.cs -----

public ExternalFeedSimulator() {
_stockGenerators= new Hashtable();
_snapshotQueue= new ArrayList();

_updateTimeMeans = new double [] {30000, 500, 3000, 90000,
7000, 10000, 3000, 7000,
7000, 7000, 500, 3000,
20000, 20000, 20000, 30000,
500, 3000, 90000, 7000,
10000, 3000, 7000, 7000,
7000, 500, 3000, 20000,
20000, 20000 };
...
}


------------ and here my changed -------------------

public ExternalFeedSimulator() {

_stockGenerators= new Hashtable();
_snapshotQueue= new ArrayList();

AutoResetEvent autoEvent = new AutoResetEvent(false);

TimerCallback handler = new TimerCallback(OnTimerEvent);
Timer timer = new Timer(handler, null, 1000, 5000);

}

---- StockList demo code, ExternalFeed.cs ----
public void Start() {
if (_snapshotSender != null) return;

for (int i = 0; i < 30; i++) {
string itemName= "item" + (i + 1);
ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName,
_openprices[i], _refprices[i], _minprices[i], _maxprices[i],
_updateTimeMeans[i], _updateTimeStdDevs[i], _stockNames[i]);

_stockGenerators[itemName]= myProducer;

...
}

-------- here my changed --------

public void Start() {

if (_snapshotSender != null) return;

for (int i = 0; i < 30; i++) {
string itemName= "item" + (i + 1);
ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName,
_openprices[i], _refprices[i], _minprices[i], _maxprices[i],
_stockSymbol[i], _ceiling[i], _floor[i], _bid1[i], _bid2[i], _bid3[i], _bid1vol[i], _bid2vol[i], _bid3vol[i], _ask1[i], _ask2[i], _ask3[i], _ask1vol[1], _ask2vol[i], _ask3vol[i], _last[i], _lastVal[i], _lastVol[i], _projectOpen[i]
);

_stockGenerators[itemName]= myProducer;
...
}


---- StockListDemo code, externalFeed.cs ----

public ExternalFeedProducer(string name,
double openPrice, double referPrice, double minPrice, double maxPrice,
double updateTimeMean, double updateTimeStdDev, string stockName) {
_itemName = name;
_open = (int) Math.Round(openPrice * 100);

_random = new Random();
_haveNextNextGaussian= false;
_nextNextGaussian= 0.0;

ComputeNewValues();
}


----- Here my changed ------------
public ExternalFeedProducer(string name,
double openPrice, double referPrice, double minPrice, double maxPrice,
string stockSymbol, int ceiling, double floor, int bid1, int bid2, int bid3, int bid1vol, int bid2vol, int bid3vol, int ask1, int ask2, int ask3, int ask1vol, int ask2vol, int ask3vol, int last, double lastVal, int lastVol, int projectOpen) {

_itemName = name;
_open = (int) Math.Round(openPrice / 100);
_refer = (int) Math.Round(referPrice / 100);

//_random = new Random(); --> remove Random() function here
//_haveNextNextGaussian= false;
//_nextNextGaussian= 0.0;

//ComputeNewValues();

}

-------StockListDemo code, ExternalFeed.cs ------
private void Run() {
do {
int waitMillis= ComputeNextWaitTime();
Thread.Sleep(waitMillis);

ComputeNewValues();
if (_listener != null)
_listener.OnEvent(_itemName, GetCurrentValues(false), false);

} while (true);
}

----- Here my changed -------
private void Run() {
do {
int waitMillis= ComputeNextWaitTime();
Thread.Sleep(waitMillis);

//ComputeNewValues();
if (_listener != null)
_listener.OnEvent(_itemName, GetCurrentValues(false), false);

} while (true);
}


--------------------
Now I start Lightstream server + DotNetServer, first time, it read file is ok, but after 5 seconds, it has error :

10.Jan.08 10:23:20,656 < INFO> Lightstreamer Server 3.4.6 build 1391 starting...

10.Jan.08 10:23:20,843 < INFO> Server "Lightstreamer HTTP Server" listening to *
:8080 ...
10.Jan.08 10:23:29,046 <FATAL> I/O Exception caught while reading/writing from/t
o streams: null, aborting...
java.io.EOFException
at com.lightstreamer.adapters.remote.request_reply.No tifyReceiver.run(No
tifyReceiver.java:77)
10.Jan.08 10:23:29,046 <FATAL> I/O Exception caught while reading/writing from/t
o streams: null, aborting...
java.io.EOFException
at com.lightstreamer.adapters.remote.request_reply.No tifyReceiver.run(No
tifyReceiver.java:77)
10.Jan.08 10:23:29,046 <ERROR> Failure invoked by Data Adapter
java.io.EOFException
at com.lightstreamer.adapters.remote.request_reply.No tifyReceiver.run(No
tifyReceiver.java:77)
10.Jan.08 10:23:29,046 <ERROR> Failure invoked by Data Adapter
java.io.EOFException
at com.lightstreamer.adapters.remote.request_reply.No tifyReceiver.run(No
tifyReceiver.java:77)
10.Jan.08 10:23:29,046 <FATAL> Failure in a Data Adapter
10.Jan.08 10:23:29,046 < INFO> Exiting.....
10.Jan.08 10:23:29,046 <FATAL> Failure in a Data Adapter
10.Jan.08 10:23:29,046 < INFO> Exiting.....
Press any key to continue . . .

What are my fault? Can you help me?