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); } }
private void btConectar_Click(object sender, EventArgs e) { bovcli.LastMsg = txtRequestMsg.Text; bovcli.Connect("10.10.91.32", "15000"); }