How to Connect multiple peers on the iPhone Application over WiFi?

后端 未结 2 539
遇见更好的自我
遇见更好的自我 2021-02-10 23:28

I have an idea for an ios(iPhone) application to which requires connecting to several peers. I am basing my code on the WiTab (SampleCode-developer.apple.com) example.

相关标签:
2条回答
  • 2021-02-10 23:52

    Its pretty hard to modify the Apple.Developer Witap application because you need to hold all the resolved adresses , have to modify all the methods and handle lot.

    I think this tutorial will achieve your goal.

    The app is called “Chatty.” Its source code is located here

    Download the App --> Open --> Click-on Chatti project tab --> Build Settings --> Change the base SDK to iOS6

    it is being released under the MIT license, which means that you are free to modify and reuse it at will

    In this tutorial, They are going to explore a simple chat application for the iPhone. It allows you to host your own chat room and advertise it on your local Wi-Fi network (in which case your app acts as a chat “server”) or find and join chat rooms hosted by other people on your network (acting as a chat “client”). Both announcement and discovery of chat rooms are implemented using Apple’s Bonjour protocol same as Witap Application

    Now I'm answering your each questions

    Is it possible to connect more than one device simultaneously over WiFi?

    YES, You can

    If yes,What is the maximum number of device that can be connected in same pattern?

    I think you can pair with any number of devices

    Which type of CFSocket is useful for multiple Connection(TCP/UDP)?

    My suggestion is TCP

    The remaining answers for your questions can be easily understand from the sample Chatty App :)

    Note: The server and clients need to be on the same WiFi network

    0 讨论(0)
  • 2021-02-10 23:53

    Depending on the nature of your app you could use GamKit Framework and it will provide even more features than your asking for. Here are the precautions to take.

    1. Game Center

    6.1 Apps that display any Player ID to end users or any third party will be rejected 6.2 Apps that use Player IDs for any use other than as approved by the Game Center terms will be rejected 6.3 Developers that attempt to reverse lookup, trace, relate, associate, mine, harvest, or otherwise exploit Player IDs, alias, or other information obtained through the Game Center will be removed from the iOS Developer Program 6.4 Game Center information, such as Leaderboard scores, may only be used in Apps approved for use with the Game Center 6.5 Apps that use Game Center service to send unsolicited messages, or for the purpose of phishing or spamming will be rejected 6.6 Apps that excessively use the network capacity or bandwidth of the Game Center will be rejected 6.7 Apps that transmit viruses, files, computer code, or programs that may harm or disrupt the normal operation of the Game Center service will be rejected

    0 讨论(0)
提交回复
热议问题