0

I have registered a service using bonjor mdnsresponder

 dns-sd -R SMARTCAM _CAMS._tcp. . 80  "u=test" "path=/pub"

When I tried to reslove by name and type as below

dns-sd -L SMARTCAM _CAMS._tcp.

I got the reply as

Lookup SMARTCAM._CAMS._tcp..local 22:16:31.777 SMARTCAM._CAMS._tcp.local. can be reached at AIR.local.:80 (interface 3) u=test path=/pub

But here I am not getting the IP address of the PC where I registered my service (I have registered the service on IP 192.168.1.123 and hostname AIR ) .

How to get the IP address of the PC now ..? because I am running some service on that IP , I want to access them after resolving

Phions
  • 105
  • 10

1 Answers1

1

Try to use $dns-sd -R and dns-sd -Q

it will get you the IP address

indra
  • 832
  • 4
  • 17
  • 33
  • Yep, getting the hostname of the device running the service and getting the IP address are separate steps. This is in part because ideally you don't need to get the IP address and instead use a network API where you connect via hostname instead of IP address, which allows code to be IPv4/IPv6 agnostic, handle multiple responses, etc. with zero effort. Stuart Cheshire gave a talk on zeroconf once where he covered such network APIs for different platforms, but I can't find it ATM. – bames53 Apr 18 '13 at 20:53
  • Here's some info on the topic, although it only covers the OS X API; [_Avoid Resolving DNS Names Before Connecting to a Host_](http://developer.apple.com/library/ios/#documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/CommonPitfalls/CommonPitfalls.html) – bames53 Apr 18 '13 at 21:00
  • And here's an IETF talk that includes Java code snippets for Java's 'connect-by-name' APIs: http://www.ietf.org/proceedings/79/slides/nbs-8.pdf It mentions that Windows has such and API but doesn't show it. – bames53 Apr 22 '13 at 21:50