DNS client on STM32 Nucleo and W5100
DNS queries can have different strategies; the details are specified in RFC1034 and RFC1035 The only strategy that I implemented at the moment is the recursive query, where we try to delegate to the DNS server the burden of finding and contacting the authoritative servers. This is done by setting the RD flag (Recursion Desired) in the message header. Many DNS servers like Google 22.214.171.124 oblige to these requests.
The code is present on my GitHub repository, and the simplest example on how to use the
getaddrinfofunction is the following:
One nice thing of implementing functions as specified by POSIX is that this code now works both on my Linux desktop as well as on my Nucleo. Moreover, the implementation uses Berkeley (POSIX) sockets, so I even verified that my implementation of
getaddrinfo can be compiled for Linux, and it works in the same way.
gethostbyname function has been removed from POSIX.1-2008, but I implemented it anyway because libraries such as
libcurl use it.
Author : Balau