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.
When my application started each peer creating separate Socket(CFSocket) and publishing through NSNetService Class.In particular instance NSNetServiceBrowser class find available peers. And display their name in TableView.When i select row in the table view the corresponding peer address resolved, a connection established and sending-receiving data was successfully.
But my intention is ,I want to select multiple row in the tableView (multiple peer). and resolved selected peers address. For that I stored selected peers information to the NSMutableArray. When i click(touch) send button , I want to resolve Selected Device address and send data to selected peers. For that i did this code
for(int k=0;k<[selectedService count];k++)
{
self.currentResolve = [self.selectedService objectAtIndex:k];
self.currentResolve = [self.selectedSer objectAtIndex:k];
[self.currentResolve setDelegate:self];
[self.currentResolve resolveWithTimeout:60];
}
But it will resolved only one device(self.selectedService objectAtIndex:0).So how can i resolved multiple peers Address/ how to established connection for multiple device. so my doubts are:-
- Is it possible to connect more than one device simultaneously over WiFi?
- If yes,What is the maximum number of device that can be connected in same pattern?
- Which type of CFSocket is useful for multiple Connection(TCP/UDP)?
- Is it required to create multiple CFSocket in each peer?
- If Yes,how? their is any documents available ?
- Is it required to established session?
- How to resolve address for mutple device?
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.
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