This doesn't enumerate even though I do have a gateway.
Did anybody have any luck with this function? Its neighbor
Did anybody have any luck with this function? Its neighbor
Code Block nw_path_enumerate_interfaces()
works fine, connection is also fine.Code Block auto path = nw_connection_copy_current_path(connection); nw_path_enumerate_gateways(path, ^bool(nw_endpoint_t gateway) { os_log_info(oslog, "Gateway!"); return true; }
I’d completely forgotten about the gateways property. Nice catch!
Anyway, I tried this out and I saw some very strange behaviour. For example, when I open a TCP connection I see the gateways property populated when the connection is in the .preparing state and then depopulated when it gets into the .ready state. This last bit is definitely a bug, one that I filed for myself (r. 74269834).
Anyway, I do see the gateways property populated during the .preparing state, which might be enough for your needs. Do you also see that? If not, how are you testing it? I’m testing on an iPhone running iOS 14.4 on Wi-Fi with a TCP connection to example.com.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Anyway, I tried this out and I saw some very strange behaviour. For example, when I open a TCP connection I see the gateways property populated when the connection is in the .preparing state and then depopulated when it gets into the .ready state. This last bit is definitely a bug, one that I filed for myself (r. 74269834).
Anyway, I do see the gateways property populated during the .preparing state, which might be enough for your needs. Do you also see that? If not, how are you testing it? I’m testing on an iPhone running iOS 14.4 on Wi-Fi with a TCP connection to example.com.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"