Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9029053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:09:25+00:00 2026-06-16T07:09:25+00:00

For an iOS app I am developing, I want multiple phone to connect to

  • 0

For an iOS app I am developing, I want multiple phone to connect to each other and be able to voice chat between those devices.

I have it working when both devices are on the same network. This was quite simple and most of the stuff I want to do, is possible.

But now I am adding internet support, which is quite a hassle. I’ll first try to explain how I want to match the devices, using a small webservice I set up.

Server

  1. Start a new GameKit session, with session-mode GKSessionModePeer
  2. Find the “Peer ID” of the server on the session I just created
  3. Create a new CFSocketRef on an free port and keep it ready to accept connections
  4. Send Peer ID and Port number to my webservice, running on an external server.

WebService

  1. Webservice receives the information and stores it together with an ID and the IP address of the client in a database.
  2. Send ID back to Server, which displays the ID

Client

  1. When the user chooses to use the “Online” feature of GameKit to search for games, I ask the user for an ID (where the user should input the ID the server receives).
  2. Client connects to the webservice supplying the ID. The webservice returns the information about the session (IP, PORT, Peer ID) of the server.
  3. The user tries to connect to the IP address, with the port information and set up an input and output stream with the server.

This does not work ofcourse, because my network does not allow incoming connections and a random port (from an external network).

But now the question is, how do I solve this? I want to be able to set up a peer to peer connection between 2 devices, those devices could be on the same network, but also on separate networks.

Is there a framework, example or anything showing how to do this? I want to be able to send data from device to device, without sending it to a server first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:09:27+00:00Added an answer on June 16, 2026 at 7:09 am

    I’m not aware of any frameworks that do this. I do however have a lot of experience with p2p networking across multiple networks.

    One important rule I learned: when communicating between networks, don’t create a direct connection unless necessary. There are just too many factors that can (will?) cause issues, such as firewalls, NATs, etc.

    Sure, you can let the connection try first. You can try to connect to the given IP addresses*, but in most cases it will fail. Even when using UPnP and NAT-PMP, you’ll find that in a lot of cases (more than half?) you won’t be able to accept incoming connections at all.

    So make sure to have a backup plan. Make a network layer abstraction that doesn’t only listen(), but also connects to a server. That way, when you can’t connect to the IPs* of the client, you simply setup a connection via the server and the network abstraction takes care of it all.

    Let me reiterate the above: don’t rely on incoming connections only, always have a backup plan.


    * I write IPs because clients can have multiple local/remote IPs. Always iterate over all these IPs when connecting. Example: my phone has 2 local IPv4 addresses (10.0.0.172 and 10.8.0.2), and an IPv6 address ([2001:x:x::6]). Of these three addresses, only the IPv6 address is publicly reachable, and the two IPv4 addresses are on different subnets so whether you can connect to them depends on the subnet that the other client is on. Always try to connect to both, and fall back to a server-proxied connection when it fails.

    ** I mentioned IPv6, yes. Let’s not forget that IPv6 is not limited by NATs, unlike IPv4, and this means that you’re far more likely to get a good connection via IPv6 than IPv4, if supported.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web app for iOS devices, and want to have a header
I'm developing an iOS app and I want to be able to have a
I'm now developing an app on iOS. With some reason, I want to use
I'm developing an iOS App and I want to make a table view, but
I'm developing an iOS app that I want it to have more than 10
I'm developing an iOS app in which I want a scroll bar like element
I am developing an ios app that uses Dropbox SDK. I want to notify
I'm developing an iOS app that enables the user to observe technical devices and
I am developing an iOS app using iOS 4.2 SDK, but I want the
I am developing an iOS app that will play music from soundcloud. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.