예제 #1
0
        public void Run()
        {
            udpclient = new UdpClient();

            collector = new Collector(countersInfo);

            startedEvent.Set();

            while (continueProcess)
            {
                try
                {
                    byte[] sendBytes = collector.CollectInfoForAllCounters();

                    //ShowBytes(sendBytes);
                    udpclient.Send(sendBytes, sendBytes.Length, endPoint);
                }
                catch (NullReferenceException ex)
                {
                    Trace.TraceError("SendBytes array is null, {0}", ex.ToString());
                }
                catch (SocketException ex)
                {
                    Trace.TraceError("Socket error mesage: {0}, code: {1}", ex.Message, ex.ErrorCode);
                }

                Thread.Sleep(DataSendInterval);
            }

        }