我可以从命令行使用 Bonjour 吗?
是否可以从命令行使用 Bonjour?例如,如果我想注册一个服务,我可以输入类似的内容:bonjour -register service_name port。然后Bonjour为我的服务分配一个免费的IP。或者,例如,如果我想查看可用服务的列表,我可以输入以下内容:bonjour -showServices。然后我得到所有可用服务的列表及其名称、IP 地址和端口。存在这样的东西吗?
我对可用的文档有点困惑。例如 这里,在文档的开头我看到:
要注册您的服务,请致电 DNS服务注册。
我应该在哪里调用它?在命令行中?在爪哇?在C++中?在蟒蛇?没有提供这种上下文有点奇怪。
一般来说,我只找到有关 Zeroconf 和 Bonjour 的一般信息(它应该做什么)。但我找不到具体而简单的东西。就像“Hello World”使用 Bonjour 的例子一样。
有人可以帮我吗?
Is it possible to use Bonjour from command line? For example if I want to register a service I type something like that: bonjour -register service_name port. And then Bonjour allocate a free IP for my service. Or, for example, if I want to see a list of available services I type something like: bonjour -showServices. And then I get list of all available services with their names, IP addresses and ports. Does something like that exist?
I am kind of confused by the available documentation. For example here, in the beginning of the document I see:
To register your service, call
DNSServiceRegister.
Where should I call it? In the command line? In Java? In C++? In python? It is kind of strange that this kind of context is not provided.
In general, I find just a general information about zeroconf and Bonjour (what it is supposed to do). But I cannot find something concrete and simple. Like "Hello World" examples of usage of Bonjour.
Can anybody help me with that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
dns-sd
是可在 Windows 和 Mac OS X 上运行的命令行程序。我经常使用它通过 ssh 通过互联网隧道传输 iTunes 共享。我的典型用法是 dns-sd -P my_music _daap._tcp。本地 3690 本地主机 127.0.0.1。假设我已经在本地主机端口 3690 上设置了一个 ssh 隧道,监听到在外部网络上共享 iTunes 的主机的端口 3689。这使得 iTunes 中出现一个名为“my_music”的 iTunes 共享小图标。
dns-sd
is the command line program that works on both windows and Mac OS X.I often use it to tunnel iTunes shares over the internet with ssh. My typical use is
dns-sd -P my_music _daap._tcp. local 3690 localhost 127.0.0.1
. This assumes that I've set up an ssh tunnel listen on localhost port 3690 to port 3689 of the host sharing iTunes on the foreign network. This makes a little iTunes share icon appear in iTunes named "my_music".mDNS 是 dns-sd 工具的旧版本。它们都是由 Apple 编写的命令行工具,用于与 Bonjour 交互。
您可以使用命令行工具对 Bonjour 执行一些操作,但引用 dns-sd 手册页:
例如,您询问“DNSServiceRegister”,这是一个 C 函数:
http://developer.apple.com/library/mac/#documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd_h/index.html#//apple_ref/c/func/DNSServiceRegister
mDNS is an older version of the dns-sd tool. They are both command line tools, written by Apple, to interact with Bonjour.
You can use the command line tool to do a few things with Bonjour, but to quote from the dns-sd man page:
For example, you asked about "DNSServiceRegister", which is a C function:
http://developer.apple.com/library/mac/#documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd_h/index.html#//apple_ref/c/func/DNSServiceRegister
是的,这当然是可能的。查看 的手册页mDNS
Yes, it is certainly possible. Take a look at the man page for mDNS