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

Add equivalent of getnameinfo #3

Open
badeend opened this issue Mar 1, 2022 · 5 comments
Open

Add equivalent of getnameinfo #3

badeend opened this issue Mar 1, 2022 · 5 comments

Comments

@badeend
Copy link
Collaborator

badeend commented Mar 1, 2022

Should the inverse of resolve_addresses be part of this proposal? Eg resolve_name based on getnameinfo.

Although they would be each other's mirror image, their use cases are very different. resolve_addresses is used by almost every application that is connected to the internet, while its inverse resolve_name is relatively niche.

  • Pro: symmetry
  • Con: Not part of the MVP spirit. Can be added later.
@sunfishcode
Copy link
Member

Another Pro is that it improves compatibility with existing code that uses this feature. But it still seems relatively niche.

What if we include it in the proposal for now, and see how it goes? If we encounter complications, we can remove it. But if it's traighforward, we can just include it, and save ourselves the extra work of discovering applications in the future that eventually need it, and then adding it for them.

@badeend
Copy link
Collaborator Author

badeend commented Apr 6, 2022

If we were to include resolve_name/getnameinfo, does that also open the door for inclusion of gethostname ?

@sunfishcode
Copy link
Member

Yeah, since we have getsockname and if we add resolve_name, gethostname isn't all that different. We should still associated it with a handle though, to avoid having an implied ambient "host".

@badeend
Copy link
Collaborator Author

badeend commented Apr 6, 2022

Not sure I see the relationship. Despite their unfortunate names, getsockname & getpeername don't return names but socket addresses. gethostname returns the name of the current computer.

We should still associated it with a handle though, to avoid having an implied ambient "host".

Ofcourse 😄 Part of the "network" capability or part of some kind of "host info" capability?

@sunfishcode
Copy link
Member

Yeah; getsockname returns an address, and then you could use getaddrinfo to get the name. That's not exactly the same as gethostname, but big picture, there doesn't seem to be a fundamental reason not to include gethostname.

Ofcourse smile Part of the "network" capability or part of some kind of "host info" capability?

This isn't necessarily definitive, Linux has separate Network and UTS namespaces, so maybe it makes sense to make this a separate "host info" capability.

badeend pushed a commit to badeend/wasi-sockets that referenced this issue Feb 25, 2023
badeend pushed a commit to badeend/wasi-sockets that referenced this issue Feb 25, 2023
Delete files that I included by accident in WebAssembly#2. The real files are named
`wasi-proposal-template.*`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants