Hi eskimo,
so finally I printed the debug description on the nwconnection during the wait stage of the state handler - and I got:
Optional([C1 MINI-20001.local:5055 tcp, indefinite, path unsatisfied (Path was denied by NECP policy), interface: pdp_ip0, ipv4])
I found a thread that pointed out this could be due to connection settings. I checked and enabled Cellular networking for my app (which will never connect via cellular) - and suddenly everything works. Switching cellular off stops the connection from connecting again?
Can you explain what is happening here?
-michael
EDIT:
I have a suspicion...
Following situation:
- The host I am connecting to is a hotspot.
- Since the device is never intended to be router (it simply provides its own network to connect to it) the DHCP of the camera does not supply a default route and when I connect to the network the connection shows "No internet connection"
- Could it be that the Bonjour lookup works through DNS - which may be blocked as the app does not seem to have internet access (due to the missing Cellular connection)?
This is a special case I guess, but the behavior is really kinda counter intuitive?
EDIT2:
Further testing:
- If the WIFI connection provides a default router (which does not exist and is shutting down internet connection via cellular all together) it seems the Cellular setting of my App does not matter and Bonjour resolves and the connection is being established.
- If the WIFI connection does not provide a default route and Cellular is turned off for the App it does not resolve the Bonjour name and the NWConnection remains in waiting.
- If the WIFI connection provides no default route, cellular is turned off for the App but Cellular is disabled for the device all together (flight mode with Wifi enabled), Bonjour names get resolved and the nwconnection gets established.
- Connecting via IP Address works always without any issues.