Esempio n. 1
0
 public void ReadAndProcessMessages()
 {
     try
     {
         while (!stopEvent.WaitOne(0))
         {
             int incomingMessage = ReadInt();
             ProcessIncomingMessage(incomingMessage);
         }
     }
     catch (IOException)
     {
     }
     catch (Exception e)
     {
         // For when TWS is closed when the trading program open
         if (parent.IsConnected())
         {
             parent.Wrapper.error(e);
         }
     }
     if (parent.IsConnected())
     {
         tcpReader.Close();
         parent.Close();
     }
 }