为什么这个主机名看起来这么奇怪?

发布于 2024-08-25 22:49:18 字数 170 浏览 6 评论 0原文

我使用 DNSSD.resolve() 方法来获取有关 Bonjour 找到的服务的信息。我能够获取找到的服务的端口及其主机名。但是,主机名看起来并不符合我的预期。我以为它是一个 IP 地址,但它等于 ID00926.local.。那是什么?我可以使用它作为 IP 地址在 Java 中创建套接字吗?

I use DNSSD.resolve() method to get information about a service found by Bonjour. I was able to get the port of the found service as well as its hostname. However, the hostname looks not as I expected. I thought it will be an IP address but it is equal to ID00926.local.. What is that? Can I use it as an IP address to create sockets in Java?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清醇 2024-09-01 22:49:18

看起来您正在获得某种本地定义的主机名,如果您位于公司网络上,则可以在本地 DNS 中获得,也可以在主机文件中获得。

查看名称是否正确解析的最简单方法是尝试对其进行 ping 操作,如果有效,则可以使用它。

不幸的是,我不熟悉 Java,所以其他人必须填写这些详细信息,但我假设您必须首先进行一些名称查找,以便获取要传递到套接字的 IP 地址。

It looks like you are getting some kind of locally defined host name, either in a local DNS if you are on a corporate network, or maybe in the host file.

The easiest way to see that the name resolves correctly is to try to ping it, if it works, then you can use it.

Unfortunately I am not familiar with Java, so someone else will have to fill in on those details, but I assume you have to do some name lookup first in order to get an IP address to pass to the socket.

尘曦 2024-09-01 22:49:18

DNSSD.register() 使用提供的主机名和端口号注册您的服务名称、类型和协议。需要第二步将主机名解析为地址。如果您不提供要注册的主机名,它将使用定义的主机名。如果没有定义的主机名,则会创建一个。这很可能就是发生的事情。

DNSSD.register() registers your service name, type, and protocol using the provided host name and port number. A second step is needed to resolve the host name into an address. If you don't provide the host name to register, it uses the defined host name. If there is no defined host name, then one is created. That's likely what happened.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文