Exemple #1
0
        internal void Init()
        {
            logger.Info($"Init() #{ID} enter.");
            IsWorking = true;

            new Thread(new ThreadStart(() =>
            {
                while (IsWorking)
                {
                    try
                    {
                        _server.Send_Internal($"{DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss.ffffff")}");
                    }
                    catch (Exception ex)
                    {
                        logger.Info($"DateTimeReporter worker #{ID} error, {ex.Message}.");
                    }
                    finally
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(1));
                    }
                }

                logger.Info($"Init() worker #{ID} done loop.");
            }))
            {
                IsBackground = true, Name = $"DateTimeReporter #{ID}"
            }.Start();
        }