2 Replies
      Latest reply on Nov 7, 2016 2:49 AM by bunuelcubosoto
      bunuelcubosoto Level 1 Level 1 (0 points)


        Peer-to-peer Wi-Fi + TCP works great. Here's how we create our TCP connection:


        self.netService = [[NSNetService alloc] initWithDomain:domain type:protocol name:name port:self.port];
        self.netService.includesPeerToPeer = YES;
        [self.netService setDelegate:self];
        [self.netService publishWithOptions:NSNetServiceListenForConnections];


        But as explained in the documentation, NSNetServiceListenForConnections doens't work for an UDP connection: "The listener supports only TCP connections."


        Is there a way to enable Peer-to-peer Wi-Fi + UDP?

        • Re: UDP and Peer-to-peer Wi-Fi
          eskimo Apple Staff Apple Staff (13,335 points)

          You might be able to get this to work by publishing a TCP service with both includesPeerToPeer and NSNetServiceListenForConnections and then, simultaneously, publishing a UDP service.  The published TCP service may be enough to triggered the necessary peer-to-peer Wi-Fi magic.

          However, even if this works it’s obviously less than ideal; I encourage you to file an enhancement request outlining your requirements and the support you’d like to the OS to provide.  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"