public NetCountersValueDistributor(CountersInfoAggregator aggregator, int distributionPeriodMs, PerfCountersStableNetClient netClient)
            : base(aggregator, distributionPeriodMs, "NetCounters (" + netClient.RemoteSideName + ")")
        {
            if (netClient == null)
            {
                throw new ArgumentNullException("netClient");
            }

            _netClient  = netClient;
            _clientData = new ClientData(LocalMachineInfo.MachineName, LocalMachineInfo.MachineAddress, LocalMachineInfo.ProcessName, LocalMachineInfo.ProcessId);
        }
Example #2
0
        /// <summary>
        /// Конструктор NetCounterFactory
        /// </summary>
        /// <param name="distributionPeriodMs">Период рассылки данных счётчиков</param>
        /// <param name="serverAddress">ip-адрес сервера</param>
        /// <param name="serverPort">Порт сервера</param>
        public NetCounterFactory(int distributionPeriodMs, string serverAddress, int serverPort)
        {
            if (distributionPeriodMs <= 1)
            {
                throw new ArgumentException("distributionPeriodMs <= 1");
            }
            if (serverAddress == null)
            {
                throw new ArgumentNullException("serverAddress");
            }
            if (serverPort <= 0 || serverPort > 65535)
            {
                throw new ArgumentException("serverPort <= 0 || serverPort > 65535");
            }

            _internalCategory  = new NetEmptyCategory("", "root", null);
            _valuesAggreagator = new CountersInfoAggregator(_internalCategory);
            _netClient         = PerfCountersStableNetClient.CreateOnTcp(serverAddress, serverPort);
            _valuesDistributor = new NetCountersValueDistributor(_valuesAggreagator, distributionPeriodMs, _netClient);
        }