DNS.Client.ClientRequest.Resolve C# (CSharp) Méthode

Resolve() public méthode

Resolves this request into a response using the provided DNS information. The given request strategy is used to retrieve the response.
Throw if a malformed response is received from the server Thrown if a IO error occurs Thrown if a the reading or writing to the socket fails
public Resolve ( ) : ClientResponse
Résultat ClientResponse
        public ClientResponse Resolve()
        {
            try {
                ClientResponse response = resolver.Request(this);

                if (response.Id != this.Id) {
                    throw new ResponseException(response, "Mismatching request/response IDs");
                }
                if (response.ResponseCode != ResponseCode.NoError) {
                    throw new ResponseException(response);
                }

                return response;
            } catch (ArgumentException e) {
                throw new ResponseException("Invalid response", e);
            }
        }

Usage Example

        public ClientResponse Resolve(Domain domain, RecordType type)
        {
            ClientRequest request  = Create();
            Question      question = new Question(domain, type);

            request.Questions.Add(question);
            request.OperationCode    = OperationCode.Query;
            request.RecursionDesired = true;

            return(request.Resolve());
        }
All Usage Examples Of DNS.Client.ClientRequest::Resolve