Exemplo n.º 1
0
        public bool Start(string user, string pw, string ipaddress, int data2)
        {
            v("got start request on blackwood connector.");
            System.Net.IPAddress bwIP = System.Net.IPAddress.Parse(ipaddress);

            // register for notification of a disconnection from the client portal
            m_Session.OnMarketDataClientPortalConnectionChange += new BWSession.ClientPortalConnectionChangeHandler(OnMarketConnectionChange);

            try
            {
                m_Session.ConnectToOrderRouting(user, pw, bwIP, Properties.Settings.Default.orderport, true, true, true);
                m_Session.ConnectToHistoricData(user, pw, bwIP, Properties.Settings.Default.historicalport);
                m_Session.ConnectToMarketData(user, pw, bwIP, Properties.Settings.Default.dataport, true);
                //if (chkUseMulticast.Checked)
                //	m_Session.ConnectToMulticast(System.Net.IPAddress.Parse(txtBoxMultiServerIP.Text), Convert.ToInt32(txtMultiDataPort.Text), true);
            }
            catch (Blackwood.Framework.ClientPortalConnectionException)
            {
                debug("error: Unable to connect to market data client portal.");
                _valid = false;
                return(_valid);
            }
            _valid = true;
            return(_valid);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Connects/Starts a client
        /// </summary>
        public bool Start()
        {
            try
            {
                // Toggle Field Value
                _logoutRequest = false;

                // Hook Blackwood events
                RegisterBlackWoodEvents(true);

                // Get IP address for establishing the connection
                IPAddress bwIp = IPAddress.Parse(_parameters.Ip);

                // Connect to Order Server
                _session.ConnectToOrderRouting(_parameters.UserName, _parameters.Password, bwIp,
                                               _parameters.Port, true, false, false, false);

                if (Logger.IsInfoEnabled)
                {
                    Logger.Info("Session connection calls successfully sent.", _type.FullName, "Start");
                }

                return(true);
            }
            catch (ClientPortalConnectionException exception)
            {
                Logger.Error(exception, _type.FullName, "Start");
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "Start");
            }
            return(false);
        }