4 Replies
      Latest reply: Nov 8, 2016 8:18 AM by rsebbe RSS
      rsebbe Level 1 Level 1 (0 points)

        Hi,

         

        we've been exploring iOS/Mac networking stack recently, and we found out there were interesting stuff but also limitations.

         

        It looks like Apple devices are not compatible with Wifi-Direct, where devices can talk to each other without being connected to the same network. But they do provide similar functionality through Bonjour (NSNetService Advertiser/Browser) networking, Multipeer Connectivity framework and Game Kit. All these only work with Apple devices, you can't establish such connection with Android device for instance.

         

        Of these APIs, Bonjour is the one where we get more control on the connection, but has its own limitations. You can't establish the connection yourself, you must use the input/output streams provided by the framework. This, in particular, also means you can't make a UDP connection between 2 devices, as you have to use the TCP one established by the framework. That also rules out networking APIs (GCDAsyncSocket, etc.) that expect to start the connection themselves.

         

        Another problem is that Wifi-Direct appears to be more and more common lately, Android, Raspberry PI, etc. This makes it hard to integrate iPhones in workflows that other platforms support and the various applications it enables.

         

        Is this analysis correct & in accordance to the current networking situation on Apple devices? Can we expect that Wifi-Direct will be provided at some point? Or at least more control in the way we establish direct connections between devices (UDP)?

         

        Thanks!

        • Re: State of Apple's "Wifi-Direct", UDP connections, etc.
          eskimo Apple Staff Apple Staff (6,675 points)

          It looks like Apple devices are not compatible with [Wi-Fi Direct] …

          Correct.  The peer-to-peer Wi-Fi support on Apple platforms uses an Apple protocol that’s unrelated to Wi-Fi Direct and not documented for third-party use.

          But they do provide similar functionality through Bonjour …

          Similar, but different in one key aspect: Wi-Fi Direct is point-to-point whereas Apple’s peer-to-peer Wi-Fi supports N x M connectivity.

          This, in particular, also means you can't make a UDP connection between 2 devices, as you have to use the TCP one established by the framework.

          UDP is definitely a challenge.  See this post.

          That also rules out networking APIs (GCDAsyncSocket, etc.) that expect to start the connection themselves.

          The peer-to-peer magic is only relevant during the connection establishment phase.  If you want to run a TCP connection with some other API, you can extract the socket from the streams and use it how you will.  Check out k and kCFStreamPropertySocketNativeHandle.

          Share and Enjoy

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

            • Re: State of Apple's "Wifi-Direct", UDP connections, etc.
              rsebbe Level 1 Level 1 (0 points)

              Thank you Quinn for your answer.

               

              By NxM, do you mean that a given advertiser (server) can have multiple clients simultaneously? Or is it something else?

              For UDP, yes I've seen it, that's the post of my colleague sitting just on my left   . We've tried, but could not get it to work, seems to be tricky.

               

              Raphael

                • Re: State of Apple's "Wifi-Direct", UDP connections, etc.
                  eskimo Apple Staff Apple Staff (6,675 points)

                  By N x M, do you mean that a given advertiser (server) can have multiple clients simultaneously?

                  Apple’s peer-to-peer Wi-Fi allows N clients to talk to M servers, much like infrastructure Wi-Fi does.  For example, if two servers, A and B, register a service, and two clients, C and D, browse for services, C can see and communicate with both A and B, and likewise for D.

                  It’s pretty neat, when it works (-:

                  For UDP, yes I've seen it, that's the post of my colleague sitting just on my left. We've tried, but could not get it to work, seems to be tricky.

                  Bummer.  As I said in the other thread, this is a perfect enhancement request candidate.  If you do file it, 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"