Beispiel #1
0
        /// <summary>
        ///   Queries for specified records.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <returns> All available responses on the local network </returns>
        public List <MulticastDnsMessage> Resolve(DomainName name, RecordType recordType = RecordType.Any)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name), "Name must be provided");
            }

            MulticastDnsMessage message = new MulticastDnsMessage {
                IsQuery = true, OperationCode = OperationCode.Query
            };

            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return(SendMessageParallel(message));
        }
Beispiel #2
0
        /// <summary>
        ///   Queries for specified records.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <returns> All available responses on the local network </returns>
        public List <MulticastDnsMessage> Resolve(string name, RecordType recordType)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Name must be provided", "name");
            }

            MulticastDnsMessage message = new MulticastDnsMessage {
                IsQuery = true, OperationCode = OperationCode.Query
            };

            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return(SendMessageParallel(message));
        }
Beispiel #3
0
        /// <summary>
        ///   Queries for specified records as an asynchronous operation.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <param name="token"> The token to monitor cancellation requests </param>
        /// <returns> All available responses on the local network </returns>
        public Task <List <MulticastDnsMessage> > ResolveAsync(DomainName name, RecordType recordType = RecordType.Any, CancellationToken token = default(CancellationToken))
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name), "Name must be provided");
            }

            MulticastDnsMessage message = new MulticastDnsMessage {
                IsQuery = true, OperationCode = OperationCode.Query
            };

            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return(SendMessageParallelAsync(message, token));
        }
Beispiel #4
0
        /// <summary>
        ///   Queries for specified records asynchronously.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <param name="requestCallback">
        ///   An <see cref="System.AsyncCallback" /> delegate that references the method to invoked then the operation is complete.
        /// </param>
        /// <param name="state">
        ///   A user-defined object that contains information about the receive operation. This object is passed to the
        ///   <paramref
        ///     name="requestCallback" />
        ///   delegate when the operation is complete.
        /// </param>
        /// <returns>
        ///   An <see cref="System.IAsyncResult" /> IAsyncResult object that references the asynchronous receive.
        /// </returns>
        public IAsyncResult BeginResolve(string name, RecordType recordType, AsyncCallback requestCallback, object state)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Name must be provided", "name");
            }

            MulticastDnsMessage message = new MulticastDnsMessage {
                IsQuery = true, OperationCode = OperationCode.Query
            };

            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return(BeginSendMessageParallel(message, requestCallback, state));
        }
        /// <summary>
        ///   Queries for specified records.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <returns> All available responses on the local network </returns>
        public List<MulticastDnsMessage> Resolve(string name, RecordType recordType)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Name must be provided", "name");
            }

            MulticastDnsMessage message = new MulticastDnsMessage { IsQuery = true, OperationCode = OperationCode.Query };
            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return SendMessageParallel(message);
        }
        /// <summary>
        ///   Queries for specified records asynchronously.
        /// </summary>
        /// <param name="name"> Name, that should be queried </param>
        /// <param name="recordType"> Type the should be queried </param>
        /// <param name="requestCallback">
        ///   An <see cref="System.AsyncCallback" /> delegate that references the method to invoked then the operation is complete.
        /// </param>
        /// <param name="state">
        ///   A user-defined object that contains information about the receive operation. This object is passed to the
        ///   <paramref
        ///     name="requestCallback" />
        ///   delegate when the operation is complete.
        /// </param>
        /// <returns>
        ///   An <see cref="System.IAsyncResult" /> IAsyncResult object that references the asynchronous receive.
        /// </returns>
        public IAsyncResult BeginResolve(string name, RecordType recordType, AsyncCallback requestCallback, object state)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Name must be provided", "name");
            }

            MulticastDnsMessage message = new MulticastDnsMessage { IsQuery = true, OperationCode = OperationCode.Query };
            message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

            return BeginSendMessageParallel(message, requestCallback, state);
        }
		/// <summary>
		///   Queries for specified records as an asynchronous operation.
		/// </summary>
		/// <param name="name"> Name, that should be queried </param>
		/// <param name="recordType"> Type the should be queried </param>
		/// <param name="token"> The token to monitor cancellation requests </param>
		/// <returns> All available responses on the local network </returns>
		public Task<List<MulticastDnsMessage>> ResolveAsync(DomainName name, RecordType recordType = RecordType.Any, CancellationToken token = default(CancellationToken))
		{
			if (name == null)
				throw new ArgumentNullException(nameof(name), "Name must be provided");

			MulticastDnsMessage message = new MulticastDnsMessage { IsQuery = true, OperationCode = OperationCode.Query };
			message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

			return SendMessageParallelAsync(message, token);
		}
		/// <summary>
		///   Queries for specified records.
		/// </summary>
		/// <param name="name"> Name, that should be queried </param>
		/// <param name="recordType"> Type the should be queried </param>
		/// <returns> All available responses on the local network </returns>
		public List<MulticastDnsMessage> Resolve(DomainName name, RecordType recordType = RecordType.Any)
		{
			if (name == null)
				throw new ArgumentNullException(nameof(name), "Name must be provided");

			MulticastDnsMessage message = new MulticastDnsMessage { IsQuery = true, OperationCode = OperationCode.Query };
			message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet));

			return SendMessageParallel(message);
		}