Example #1
0
        /// <summary>
        /// Connects/Starts a client
        /// </summary>
        public bool Start()
        {
            try
            {
                // Read account credentials
                _credentials = CredentialReader.ReadCredentials("RediParams.xml");

                if (!CheckParameterValidity())
                {
                    return(false);
                }

                // Create TCP Request
                _rediSocketConnection = new SocketCommunication(new Queue(), _credentials.Username,
                                                                _credentials.Password, _credentials.IpAddress, Convert.ToInt32(_credentials.Port), _logger);

                _rediSocketConnection.SendMessage += DataRecieved;
                _rediSocketConnection.ErrorInTcp  += new SocketCommunication.ConnectionError(RediSocketConnectionErrorInTcp);

                _isConnected = true;
                _rediSocketConnection.Connect();

                if (_logger.IsInfoEnabled)
                {
                    _logger.Info("Session is available.", _type.FullName, "Start");
                }

                if (LogonArrived != null)
                {
                    LogonArrived(_marketDataProviderName);
                }

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