I have a Java based server using JmDNS which is being discovered from an iOS app.
The discovery works fine and this is the callback that gets executed by the NetServiceDelegate to record the details:
public func netServiceDidResolveAddress(_ service: NetService) {
guard let hostName = service.hostName else {
return
}
mockServerUrl = "http://\(hostName):\(service.port)/analytics"
Logger.log("Using mock server at \(mockServerUrl)", forLevel: .info)
}
This results in a URL that looks like this: http://az-mbp-ether-lan.local.:9090
Now I swear this was working, however now when I try and send data to this endpoint with Alamofire it consistently times out.
Replacing the hostname with the hardcoded IP address of the target machine makes it work again, so there is no fundamental issue with the code sending the data.
Should an address of the form above ending in ".local." be resolvable from an iOS device on the same network as the target server?