When I register new service with DNS-SD api in C and then try to discover this service on another computer in my LAN, I am getting after resolving this discovered service something like this:
Here hostname is: Michal's-iMac-5k.local.
How this translates to IP addrees, or how to use it to connect via TCP socket?
Be careful about the hostname - it doesn't contain the apostrophe.
You can translate hostname to IP using CFHost https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/ResolvingDNSHostnames.html#//apple_ref/doc/uid/TP40012543-SW2
and create a connection using this https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html#//apple_ref/doc/uid/CH73-SW4
or this https://developer.apple.com/library/content/qa/qa1652/_index.html#//apple_ref/doc/uid/DTS40008977