예제 #1
0
        public void OnBovespaError(int error, string msg, string description)
        {
            logger.ErrorFormat("OnBovespaError({0},{1},{2})", error, msg, description);

            if (bovcli.IsConectado)
            {
                bovcli.Disconnect();
            }

            bovcli = null;
        }
예제 #2
0
        public void Run()
        {
            int lastTrial = 600;

            while (_bKeepRunning)
            {
                if (bovcli == null && lastTrial > 600)
                {
                    bovcli       = new BovespaClientSinal();
                    bovcli.Debug = false;

                    if (this.ultimoMsgId != null && this.ultimoMsgId.Length > 0)
                    {
                        bovcli.LastMsg = this.ultimoMsgId;
                    }
                    else
                    {
                        bovcli.LastMsg = DateTime.Now.ToString("yyyyMMddA0006000002");
                    }

                    bovcli.OnConnect      += new BovespaOnConnectEventHandler(OnBovespaConnect);
                    bovcli.OnDataReceived += new BovespaDataReceivedEventHandler(OnBovespaDataReceived);
                    bovcli.OnDisconnect   += new BovespaOnDisconnectEventHandler(OnBovespaDisconnect);
                    bovcli.OnError        += new BovespaOnErrorEventHandler(OnBovespaError);

                    bovcli.Connect(parametros.ServidorProxyDiff, Convert.ToString(parametros.PortaProxyDiff));

                    lastTrial = 0;
                }
                else
                {
                    lastTrial++;
                }

                Thread.Sleep(100);
            }
        }
예제 #3
0
        public void OnBovespaDisconnect(string description)
        {
            logger.Info("OnBovespaDisconnect(" + description + ")");

            bovcli = null;
        }