示例#1
0
        /// <summary>
        ///     <para>Initializes the UdpServer listening for incoming packets asynchronously</para>
        /// </summary>
        public void Start()
        {
            if (IsInitialized)
            {
                return;
            }

            if (BindingEndpoint == null)
            {
                m_Server = new UdpClient(Port);
            }
            else
            {
                m_Server = new UdpClient(BindingEndpoint);
            }

            UdpState s = new UdpState(m_Server, new IPEndPoint(IPAddress.Any, Port));

            m_Server.BeginReceive(new AsyncCallback(DataReceiveCallback), s);
            IsInitialized = true;
        }
示例#2
0
        /// <summary>
        ///     <para>Initializes the UdpServer listening for incoming packets asynchronously</para>
        /// </summary>
        public void Start()
        {
            if (IsInitialized)
            {
                return;
            }

            if (BindingEndpoint == null)
            {
                m_Server = new UdpClient(Port);
            }
            else
            {
                m_Server = new UdpClient(BindingEndpoint);
            }

            UdpState s = new UdpState(m_Server, new IPEndPoint(IPAddress.Any, Port));

            m_Server.BeginReceive(new AsyncCallback(DataReceiveCallback), s);
            IsInitialized = true;
        }