Any chance some variant of socket library has support for socket.gethostbyaddr?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Any chance some variant of socket library has support for socket.gethostbyaddr?

Post by Jibun no kage » Sun Aug 07, 2022 1:55 am

Any chance some variant of socket library has support for socket.gethostbyaddr?

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: Any chance some variant of socket library has support for socket.gethostbyaddr?

Post by Jibun no kage » Mon Aug 08, 2022 2:57 am

Let me ask a different way, would it be something that might be added, feature add to say the MicroPython usocket module?

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Any chance some variant of socket library has support for socket.gethostbyaddr?

Post by scruss » Mon Aug 08, 2022 2:28 pm

I doubt it: gethostbyaddr is no longer recommended for general use:

Code: Select all

       The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror()
       functions are obsolete.  Applications should use getaddrinfo(3),
       getnameinfo(3), and gai_strerror(3) instead.
(source: gethostbyname(3) Linux manual page).

MicroPython docs add: "Using getaddrinfo is the most efficient (both in terms of memory and processing power) and portable way to work with addresses.".

What does getaddrinfo not do for you?

Post Reply