public static void ReceiveCallback(IAsyncResult ar)
        {
            UdpClient  u = (UdpClient)((UdpState)(ar.AsyncState)).u;
            IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;

            if (Paused)
            {
                if (IsRunning)
                {
                    u.BeginReceive(new AsyncCallback(ReceiveCallback), ((UdpState)(ar.AsyncState)));
                }
                return;
            }

            Byte[] receiveBytes;

            try
            {
                receiveBytes = u.EndReceive(ar, ref e);
            }
            catch (ObjectDisposedException ex)
            {
                return;
            }

            string receiveString = Encoding.ASCII.GetString(receiveBytes);

            Console.WriteLine("Received: {0}\n", receiveString);

            rPodNetworkNode n = new rPodNetworkNode(receiveString.Substring(6), e.Address.ToString(), false);

            n.NodeAnnounceSeen();

            if (ActiveNodes == null)
            {
                ActiveNodes = new List <rPodNetworkNode>();
            }

            if (ActiveNodes.Contains(n) == false)
            {
                ActiveNodes.Add(n);
                FoundNewNode(n);
            }
            else
            {
                ActiveNodes.FirstOrDefault(x => x.Equals(n)).NodeAnnounceSeen();
            }

            if (IsRunning)
            {
                u.BeginReceive(new AsyncCallback(ReceiveCallback), ((UdpState)(ar.AsyncState)));
            }
        }
        public static void ReceiveCallback(IAsyncResult ar)
        {
            UdpClient  u = (UdpClient)((UdpState)(ar.AsyncState)).u;
            IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;

            if (Paused)
            {
                if (IsRunning)
                {
                    u.BeginReceive(new AsyncCallback(ReceiveCallback), ((UdpState)(ar.AsyncState)));
                }
                return;
            }

            Byte[] receiveBytes;

            try
            {
                receiveBytes = u.EndReceive(ar, ref e);
            }
            catch (ObjectDisposedException ex)
            {
                return;
            }

            string receiveString = Encoding.ASCII.GetString(receiveBytes);

            Console.WriteLine("Received: {0}\n", receiveString);

            string[] tokens = receiveString.Split(',');
            if (tokens.Length == 5)
            {
                if (tokens[0] == "rPod!")
                {
                    int      id      = int.Parse(tokens[1]);
                    DateTime PiTime  = DateTime.Parse(tokens[3]);
                    bool     logging = false;
                    if (tokens[4] == "yes")
                    {
                        logging = true;
                    }
                    rPodNetworkNode n = new rPodNetworkNode(tokens[2], e.Address.ToString(), false, logging, PiTime);
                    n.NodeAnnounceSeen(logging, PiTime);

                    if (ActiveNodes == null)
                    {
                        ActiveNodes = new List <rPodNetworkNode>();
                    }

                    if (ActiveNodes.Contains(n) == false)
                    {
                        ActiveNodes.Add(n);
                        if (FoundNewNode != null)
                        {
                            FoundNewNode(n);
                        }
                    }
                    else
                    {
                        ActiveNodes.FirstOrDefault(x => x.Equals(n)).NodeAnnounceSeen(logging, PiTime);
                    }
                }
            }
            if (IsRunning)
            {
                u.BeginReceive(new AsyncCallback(ReceiveCallback), ((UdpState)(ar.AsyncState)));
            }
        }