예제 #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(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.
        /// </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));
        }
예제 #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);
		}