Ejemplo n.º 1
0
        /// <summary>
        /// Starts the socket server.It registers some types with compact Framework,
        /// enables simple logs as well as DetailedLogs, then it checks Ncache licence information.
        /// starts connection manager and perfmon counters.
        /// </summary>
        /// <param name="bindIP" ></param>
        ///
        public void Start(IPAddress bindIP, LoggerNames loggerName, string perfStatColInstanceName, CommandManagerType cmdMgrType, ConnectionManagerType conMgrType)
        {
            if (loggerName == null)
            {
                _loggerName = LoggerNames.SocketServerLogs;
            }
            else
            {
                _loggerName = loggerName;
            }
            InitializeLogging();


            if (ServiceConfiguration.PublishCountersToCacheHost)
            {
                _perfStatsColl = new CustomStatsCollector(cacheName, _serverPort);
            }
            else
            {
                _perfStatsColl = new PerfStatsCollector(cacheName, _serverPort);
            }


            _conManager = new ConnectionManager(_perfStatsColl);

            _conManager.Start(bindIP, _serverPort, _sendBuffer, _recieveBuffer, _logger, cmdMgrType, conMgrType);

            if (ConnectionManagerType.HostClient == conMgrType)
            {
                _hostClientConnectionManager = _conManager;
            }

            //We initialize PerfstatsCollector only for SocketServer's instance for client.

            //Management socket server has just DUMMY stats collector.
            if (conMgrType == ConnectionManagerType.HostClient)
            {
                _perfStatsColl.InitializePerfCounters();
            }
        }