Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing gethostname function (IDFGH-14028) #14849

Open
3 tasks done
DBMTC opened this issue Nov 8, 2024 · 5 comments
Open
3 tasks done

Missing gethostname function (IDFGH-14028) #14849

DBMTC opened this issue Nov 8, 2024 · 5 comments
Assignees
Labels
Status: Opened Issue is new

Comments

@DBMTC
Copy link

DBMTC commented Nov 8, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

The function gethostname is not defined anywhere, exactly as reported here: #1102 except in newer releases the lwip_tcp_ip_adapter component has been removed and the provided solution cannot be used anymore (nor should be in older releases as that component has been deprecated a long time ago).

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 8, 2024
@github-actions github-actions bot changed the title Missing gethostname function Missing gethostname function (IDFGH-14028) Nov 8, 2024
@atanisoft
Copy link

esp_netif_get_hostname could replace the older approach for retrieving the hostname.

@DBMTC
Copy link
Author

DBMTC commented Nov 11, 2024

esp_netif_get_hostname could replace the older approach for retrieving the hostname.

Okay, I will get that tested as soon as possible. Is it possible to have the standard function call this function? As it is a bit weir having to do this in a library with code shared among many microcotrollers.

@atanisoft
Copy link

Is it possible to have the standard function call this function?

Possibly, that may be a good use for this ticket (implement a default version of the API).

In the projects I maintain I've included a standard version of this function in common code shared across a few projects. But it would be nice to have it included by default (same would go for gai_strerror which wouldn't be too much to include either)

@igrr
Copy link
Member

igrr commented Nov 11, 2024

Linking espressif/esp-protocols#671 for gai_strerror

@david-cermak
Copy link
Collaborator

We will support these two functions (gethostname() and gai_strerror()) via an external component called sock_utils, which provides a very simplified implementation of some common socket/network/system related functionality. The idea is to provide "some" functionality first (not necessarily 100% correct, but good enough) to simplify porting efforts.

For instance gai_strerror() just returns a textual representation of the error number and gethostname() uses a preferred network interface hostname (unlike standard POSIX gethostname(), which returns a system wide, global hostname)

PS: Adding gethostname() in espressif/esp-protocols#707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

5 participants