/// <summary>
        /// Tell the channel to set itself up and start processing data
        /// </summary>
        public void Start()
        {
            if (System.Threading.Interlocked.CompareExchange(ref _running, 1, 0) > 0)
            {
                return;
            }

            if (_udpChannel == null)
            {
                if (_localEndPoint != null)
                {
                    _udpChannel = new UDPChannel(_localEndPoint);
                }
                else
                {
                    _udpChannel = new UDPChannel(_port);
                }
            }

            _udpChannel.DataReceived += ReceiveData;
            if (SendBufferSize > 0)
            {
                _udpChannel.SendBufferSize = SendBufferSize;
            }
            if (ReceiveBufferSize > 0)
            {
                _udpChannel.ReceiveBufferSize = ReceiveBufferSize;
            }

            _udpChannel.Start();
        }
Example #2
0
        public void Start()
        {
            if (System.Threading.Interlocked.CompareExchange(ref _running, 1, 0) > 0)
            {
                return;
            }

            if (_udpChannel == null)
            {
                if (_localEP != null)
                {
                    _udpChannel = new UDPChannel(_localEP);
                }
                else
                {
                    _udpChannel = new UDPChannel(_port);
                }
            }

            _udpChannel.DataReceived += ReceiveData;

            _udpChannel.Start();
        }