Jump to main content

##

# TCPIP_DNS_Enable Function

## C

    bool TCPIP_DNS_Enable(
        TCPIP_NET_HANDLE hNet,
        TCPIP_DNS_ENABLE_FLAGS flags
    );

## Description

This function enables the DNS Client name resolution for the specified interface. The additional flags give better control on how the name resolution is performed.

## Preconditions

The DNS module must be initialized.

## Parameters

Parameters | Description
--- | ---
hNet | Interface to enable the DNS Client on.
flags | Specify further attributes for this interface: act as a strict, preferred or default interface.

## Returns

- True - If successful.
- False - If unsuccessful: the requested interface could not be selected for DNS name resolving.

## Remarks

The interface selection for the name resolution tries to find a valid interface, i.e. an interface that is up and has a valid DNS server. The selection is done following these rules:

- if a strict interface is set, only that interface is used for name resolution
- else if there is a preferred interface, that one will be tried first
- else the default interface is used
- else any available interface will be used

Additionally, if a retry is attempted using the same selected interface, an alternate DNS server from that interface will be selected, if available.

Only one strict interface can exist at any time. Selecting a new strict interface will replace the old one.

Only one preferred interface can exist at any time. Selecting a new preferred interface will replace the old one.

The selected interface has to be up and running for the call to succeed.