9 Replies
      Latest reply: Sep 21, 2016 2:07 AM by eskimo RSS
      svjim Level 1 Level 1 (0 points)

        I have a customer with a device that connects to an ios device via its own internal hot spot. The problem is that there is a need to access the internet for forwarding data and this can only be done by a celluar connection. Most of the time the device will not have access to another external wifi network. I have seen some suggestions on setting the gateway address to 0.0.0.0 and that iOS will then use the celluar networ for other apps, but I need the app to be able to talk to both the wifi and celluar networks.

         

        Any help or suggestions would be appreciated,

         

        Jim

         

        I should explain, that there is an ios app that is used to connect to the device. So it would be that app or a similar app connected via the devices hotspot that would need the concurrent connections.

        • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
          eskimo Apple Staff Apple Staff (6,665 points)

          The critical issue here is Wi-Fi auto join.  Let me explain…

          iOS fully supports multiple network interfaces but there are some non-obvious interactions that you have to be aware of.  Specifically, when iOS tries to auto join a Wi-Fi network, it probes the network to see if its functioning.  If it's not, it disassociates from the Wi-Fi, leaving the default interface set to WWAN.

          This disassociation does not happen when the user manually joins the network.

          So, you have two choices here:

          • If you configure your Wi-Fi network to satisfy the auto join probe, then iOS will switch the default route to Wi-Fi.  WWAN stays up and is used by critical system services (like push notifications), but most apps will switch to using the (dysfunctional) Wi-Fi.

            In this environment you can write code to run your network requests over WWAN but you'll have to use low-level APIs because our high-level APIs don't have a way to force a request to run over WWAN.

          • If you configure your Wi-Fi network to not satisfy the auto join probe, iOS will not auto join the network (well, it'll auto join then auto leave).  The user will have to manually join the network.  Once they do, the default route will stay on WWAN but your app will be able to talk to devices on the Wi-Fi because the Wi-Fi will be up and running; it's just not the default route.

          Share and Enjoy

          Quinn "The Eskimo!"
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
              Rum Level 2 Level 2 (25 points)

              In this environment you can write code to run your network requests over WWAN but you'll have to use low-level APIs because our high-level APIs don't have a way to force a request to run over WWAN.

               

              Does this mean IP_BOUND_IF for socket? Is this legal API on iOS?

                • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
                  eskimo Apple Staff Apple Staff (6,665 points)

                  Does this mean IP_BOUND_IF for socket?

                  Yes.  There are other options (like calling bind with the interfaces source address) but IP_BOUND_IF is the easiest.

                  Is this legal API on iOS?

                  Yes.

                  There are two gotchas here:

                  • You have to work out the interface name you want to bind to (IP_BOUND_IF take an interface number, but you can get that from the name using if_nametoindex).  These interface names are not considered API.  You can call various APIs to try to infer the right interface name, but there's no direct API that answers the questions What's the Wi-Fi interface name? or What's the WWAN interface name?

                  • If the service you ultimately want to talk to is based on HTTP, it's definitely not fun implementing your own HTTP engine.  Likewise for other high-level protocols.

                  Finally, you're not the first developer to have problems with this sort of setup and it's clear that iOS could provide better support for it.  If you'd like to see such support added in the future, I encourage you to file an enhancement request describing your requirements.  While we may have seen similar requests many times before, a fresh bug report will allow you to express your needs in your own terms, and allow iOS engineering to gauge the level of demand.

                  Please post your bug number, just for the record.

                  Share and Enjoy

                  Quinn "The Eskimo!"
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
                  svjim Level 1 Level 1 (0 points)

                  Thank you,

                   

                  As the device the customer wants to interface is Autojoined, I guess the only option will be low level code assuming that is available. Can you please verify that the required low level api's are not restricted to Apple only.

                   

                  Thanks Again,

                   

                  Jim

                    • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
                      eskimo Apple Staff Apple Staff (6,665 points)

                      Can you please verify that the required low level api's are not restricted to Apple only.

                      The APIs I've mentioned are all part of the public iOS SDK.  That's as much of a guarantee as I'm able to give you.  The only folks who can definitively say what is or isn't allowed on the store is App Review, and I can't speak on their behalf

                      Share and Enjoy

                      Quinn "The Eskimo!"
                      Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                      let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
                      a-Lexx Level 1 Level 1 (0 points)

                      What are the criteria for iOS to consider WiFi connection "functional"?

                    • Re: Is it possible to have an iOS app with concurrent wifi and cellular connections?
                      bhawnabhandari Level 1 Level 1 (0 points)

                      Did you find any solution to this? I am still struggling to make it work.