Exemple #1
0
            private void OnUdpReady(Socket socket)
            {
                string     peerName;
                NetMQFrame frame = this.ReceiveUdpFrame(out peerName);

                // If filter is set, check that beacon matches it
                bool isValid = frame.MessageSize >= this.m_filter?.MessageSize && Shim.Compare(frame, this.m_filter, this.m_filter.MessageSize);

                // If valid, discard our own broadcasts, which UDP echoes to us
                if (isValid && this.m_transmit != null)
                {
                    if (frame.MessageSize == this.m_transmit.MessageSize && Shim.Compare(frame, this.m_transmit, this.m_transmit.MessageSize))
                    {
                        isValid = false;
                    }
                }

                // If still a valid beacon, send on to the API
                if (isValid)
                {
                    this.m_pipe.SendMoreFrame(peerName).SendFrame(frame.Buffer, frame.MessageSize);
                }
            }