This recipe will show you how to write code that will run on MicroPython to perform a DNS lookup. Whenever our applications try and connect to the host, one of the first steps is to look up the hostname using the DNS protocol and get the host's IP address so that you can open a connection to that IP address.
This recipe shows you how to perform that DNS lookup, and then takes those lines of code and packages them into a function that you can call whenever you want to get the IP address of a specific host. This recipe can be useful in your projects whenever you want to keep track of a hostname and its related IP address, or when you face networking issues on your devices or network and want some simple tests to troubleshoot what's going on.