コード例 #1
0
        void SendPacket(bool isMultiCast)
        {
            if (_waiting || _stopped)
            {
                _timerRunning = false;
                return;
            }

            //Create Packet
            var packet = new Packet();

            packet.Flags.IsResponse = false;
            packet.Queries.Add(new Query()
            {
                IsMulticast = isMultiCast,
                Record      = new Record()
                {
                    Class      = 1,
                    Name       = _proto,
                    RecordType = 12,
                },
            });

            //Send it
            try
            {
                _service.SendPacket(packet);
            }
            catch (SocketException ex)
            {
                //Likely temporary disconnect, try again next time
            }
            finally
            {
                //Setup next request
                _timerRunning = true;
                _timer.FireNext(delays[nextDelayIndex]);
                AdvanceDelay();
            }
        }