iPhone to iPhone networking - iphone

I am interested in developing an iPhone application that creates ad-hoc networks between iPhones.
Is such an application feasible?
I am a novice with iPhone development, so I apologise in advance for my naiivety.
Thanks

In iPhone OS 3.0, Bluetooth is used to create an ad-hoc network and has been developed for this purpose.
Here is some documentation.
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/GameKit_Guide/GameKitConcepts/GameKitConcepts.html
On a side note, there are some games that use the current access point and scan the subnet that they are on and find other listening clients. Then they create a game that way.

I know this is an old question, but since I just researched a similar topic, I wanted to share the results in case it's helpful to someone who searches for this in the future.
Newer iOS versions include Game Kit, a set of APIs allowing developers to create peer-to-peer networking systems over WiFi or Bluetooth. This appears to be exactly what the poster is requesting.

Related

Communication between two iOS devices

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

Is it possible, in principle, for an Android device to interface with an iPhone over Bluetooth/GameKit?

(I am not interested in pure theory, but as a practical near or mid-term possibility, say within 12-24 months.)
As a developer familiar with (but not specializing in) two major smartphone platforms, should I expect an Android library to come out which can spoof itself onto an iPhone app's GameKit-based network. It seems reasonable that a Bluetooth interface between platforms might square the opportunity to make useful applications, in the same way that modems benefited PC/Mac platforms via Metcalfe's Law.
I am looking for one of two answers:
Is this obviously not likely (e.g. because of encryption)? If so, what is the reason? Is it possible in principle, but requiring years of reverse-engineering (like SMB/CIFS/Samba)? Or is it a no-brainer and just a matter of time? Please give evidence supporting your reason.
Is there an alternative way to have direct peer-to-peer networking besides GameKit? For example, a hand-rolled network using Bluetooth or ad-hoc WiFi? It would be nice to spoof an Android device into an existing iPhone app but my main question is, can the devices speak with each other at all!
Yes, it is possible. GameKit is a protocol using TCP and/or UDP over a BNEP Bluetooth connection. It also uses a trick to identify other iOS devices using the Extended Inquiry mechanism in Bluetooth 2.1+.
I was able to simulate the EIR responses, now, someone needs to reverse engineer the GameKit protocol. This doesn't need Bluetooth, as it is also used for GameKit connections over WLAN.
If anybody can re-implment GameKit for WLAN connections, I can finish the Bluetooth version.
No, and it wont come soon or even at all... Apple pride themselves with their security features, and bluetooth connections can access private data. There will probably not be any cross platform bluetooth framework until something is agreed upon by both companies.
Bump as said by a previous answerer uses a remote server, and the data transferred is not via BT.
GameKit is Bonjour so a Bonjour (which is on IP) over Bluetooth on Android should work.
That should be possible as Bluetooth is capable of setting up tcp/ip networks. Though I have no knowledge of the IPhone SDK whatsoever, but Android does have a BluetoothSocket and BluetoothServerSocket for TCP connections.
This article, http://blog.moritzhaarmann.de/blog/2014/04/27/sorry-state-of-p2p/ written in 2014, suggest it is possible via Bluetooth LE. Available in Android 4.3+ and iOS6+
Two issues:
According to the Android Dashboard only around 30 percent of Android devices support Bluetooth LE https://developer.android.com/about/dashboards/index.html?utm_source=ausdroid.net
Communication between Android-to-Android must be done using some other method (which is not a big problem) because Android devices cannot act as server for B LE connections.
Bounjour on the iPhone gives you full access to all of the Bluetooth protocols, so you don't have to use GameKit. As for when someone will provide an easy to use iPhone to Android GameKit like framework - hard to tell.
An iPhone can already talk to any other Bluetooth device using Bonjour today.
-t
It is absolutely possible! In fact I am amazed that more people haven't done it!
Theory:
Bluetooth is just a wireless socket that you push data across and it comes across the other side, just like tcp/ip.
Practice:
http://www.techcrunch.com/2009/11/11/bump-goes-cross-platform-with-new-android-app-upgrades-iphone-version-too/
Better yet, Bump is cross-platform, which means that you can bump an Android phone with an iPhone and it should work seamlessly.

Finding the systems connected in local network from iPhone?

I am developing an application which identifies(find) all the systems connected in same network/LAN to share the data.
could please share with me how to identify(find) the systems which are connected in same network/LAN.
thanks in advance.
When you say all systems, I assume you mean all instances of your application? If so then the correct solution is to use Bonjour. Documentation on how to use it can be found here. Note that your app needs to be actively running on all the devices that you are trying to discover, since the iPhone does not support background apps.
If you are just talking about finding all other devices in the area then you need to resort to techniques like port scanning.

iPhone network game programming

I'm interested in writing an iPhone game which uses the network to allow users on different iPhones to play against each other. I'm looking for an example of a game with source code which does this. I need some simple examples and documentation. Where should I look? I'm brand new to iPhone programming. Thank you!
If you want to avoid just using GameKit, or you want to use the local wireless network alongside GameKit, the people who made BeamIt have very kindly published the source code for us all.
http://arctouch.com/beamit/developers/
For GameKit (peer-to-peer via Bluetooth), there is Apple's sample application GKTank. If you're interested in Bonjour discovery and communication over the local network, Apple has the sample application WiTap.
That is a big ask :)
A book you might find useful (as it has recipes for most of what you'll need to do) is Erica Sadun's excellent "IPhone Developer's Cookbook"
Kindness,
Dan
Most of the pieces that you need have examples on the apple site. You'll just have to put them together.
http://developer.apple.com/iphone/

iPhone Gamekit peer with a desktop peer

I am looking for a way to establish a wireless connection between an iPhone and a desktop client. Gamekit looks promising but all the examples / documentation only explain iPhone to iPhone.
Are there examples / documentation for an Gamekit peer on the desktop (cocoa or java)?
What are the alternatives without doing to much low level socket programming?
The iPhone emulator does not run these bluetooth p2p connections. Hence, it can only be tested with real hardware.
It is a little confusing because the GKSession reference talks only about being a way to connect peers over bluetooth, while the GKPeerPickerController states "can be configured to select between Bluetooth and Internet connections." However there's a clear note there that they're not really going to help you with internet based connections.
This is unfortunately a non-answer, but...
GameKit is an abstraction of the bluetooth and wifi networking layers, allowing a specific set of protocols for communication between two devices -- to communicate with a desktop client, you would need to replicate all of the GameKit functionality on the desktop, since there is no comparable API on the desktop. This would not be a simple undertaking.
I would highly suggest developing something over bonjour, as #Jordan suggested. Bill Dudney's project (blog article). It's a great place to start.
Citing Game Kit Framework Reference's Features paragraph:
Peer-to-peer connectivity allows your game to create an ad hoc Bluetooth or wireless network between multiple iPhones in the same local area. Although designed with games in mind, this network is useful for any type of data exchange among users of your app. For example, an app could use peer-to-peer connectivity to share electronic business cards or other data. This functionality is only available on iOS. You can also get the same functionality using Game Center.