I am using NSURLConnection to access the web service (on the .local host). When I access the host by the host name, I see a delay of 5+ seconds, but when I access it by IP, the connection ends almost instantly. Running the application on a real iPhone instead of a simulator does not cause any delays (testing was carried out with the same network connection). So this seems to be a problem specific to iOS Simulator or OS X.
I can simulate the problem using the following terminal commands:
nslookup webservice.myhost.local (which is fast)
dscacheutil -q host -a name webservice.myhost.local ( shows the delay )
When analyzing network traffic using the dscacheutil command of the dscacheutil command dscacheutil I see several Standard query AAAA requests that are marked in red and receive an empty answer. Once they are completed, I see the query Standard query A , which has a response containing the correct IP address. AAAA requests take about 5 seconds, which explains the delay.
RenΓ© source share