Skip to content

net.dns.resolve() has unexpected callbacks #3362

Open
@kit-klein

Description

@kit-klein

Expected behavior

net.dns.resolve() should return an ip address in it's callback for the ip arg

Actual behavior

ip always seems to be nil

Test code

Start with a nodemcu based device connected to the internet. Execute the following from the console.

> net.dns.setdnsserver("8.8.8.8", 0)
> 
> print(net.dns.getdnsserver(0))
8.8.8.8
> 
> 
> net.dns.resolve("google.com", function(sk, ip) if (ip == nil) then print("DNS fail!") else print(ip) end end)
> DNS fail!

> 
> net.dns.resolve("google.com", function(sk, ip) if (sk == nil) then print("DNS fail!") else print(sk) end end)
> 142.250.64.110

You can see in the first call of net.dns.resolve we get nil for the expected ip (which is the second argument in the docs). It appears the ip is actually placed in the first cb argument based on the next attempt.

NodeMCU startup banner

NodeMCU ESP32 built with Docker provided by frightanic.com
        branch: dev-esp32
        commit: 7c07f914836d73e22e862c149def8b3314b77e43
        SSL: true
        modules: -
 build created on 2021-01-04 16:25
 powered by Lua 5.1.4 on ESP-IDF v3.3.2 on SDK IDF

Hardware

Konnected Pro board but should apply to any esp32 based device running nodemcu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions