Communication over wifi or wirless access points in iOS device - ios

I am looking for making my app compatible with wifi in the same infrastructure. So is there any SDK that can support bi-directional communication without internet, we assume that devices will be placed closed to each other.
Regards,
Aamir

Apple provides the Multipeer Connectivity Framework:
The Multipeer Connectivity framework provides support for discovering
services provided by nearby iOS devices using infrastructure Wi-Fi
networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and
subsequently communicating with those services by sending
message-based data, streaming data, and resources (such as files).
This SO answer directly addresses your question.

Related

iOS - How to send message from hotspot (iPhone) to connected client (IoT device)

I've searched google and only found the MultipeerConnectivity framework in iOS but I don't know how I could make it work for my specific case.
The flow of what I want to do is like this:
Enable personal hotspot in iOS
Connect to hotspot from a raspberry pie
Once client is connected, send a message string from the iOS app.
Assuming that the raspberry pie connection is already sorted out (We're using a static SSID and Password for the hotspot)
The questions that come up are:
Which framework should I use (assuming there is one already)?
do I need to explicitly advertise the iOS device from the app?
How do I get notified when the raspberry connects to the phone?
How do I send a message to the connected client?
Although I never developed anything for Pi, I developed net service browsing for iOS devices, so can give an answer.
When you connect to iPhone hotspot, it's a usual WiFi connection, so here you can use Bonjour protocol (mDNS) to discover devices one another.
Run Avahi mDNS service on Pi, and discover it on iPhone.
Here is how to run Avahi on Pi.
Here is how to discover mDNS net service on iPhone.
After net service is discovered with NSNetServiceBrowser, you'll have IP address and port of your Pi available on your iPhone, so you can connect to it.
If you are trying to setup a IoT system, it may be useful to look into various cloud offerings to facilitate messaging between devices. Personally I have used AWS IoT core services in the past, and it is relatively easy to setup messaging between devices.
I am not sure what your exact use case is for this setup, but using a cloud based service to setup messaging between devices will remove the requirement to connect directly between devices via hotspot (the pi still needs some internet connection), and could make it easier to enable multiple devices and app clients in the system.

What to choose for data share in same wifi network: Multipeer, Bonjour, Socket connection

I am working on data share over same wifi two/more iOS devices.I have successfully implemented it using multipeer networking and explored it from videos documents.I am just looking on apple Dev for difference between Bonjour vs Multipeer Networking. Is there some one in group who have worked on both and can share me his experience with what to choose.
My requirement:
Connect two/more iOS device in Same Wifi Network
Automatic Discovering and Connectivity.
Data Size Can be 1 KB to 1 GB.(working on it with MC).
Resume data share when disconnect and connect(looking for it with MC).
Which is more reliable?
What will YOU choose?
I am also looking at GCDAsyncSocket(Don't know i m on right direction).
So please share your experience.
Thanks.
As per documentation says:
The Multipeer Connectivity Framework provides a layer on top of Bonjour that lets you communicate with apps running on nearby devices (over infrastructure Wi-Fi, peer-to-peer Wi-Fi, and either Bluetooth (for iOS) or Ethernet (for OS X) without having to write lots of networking code specific to your app.

Sharing Data Between iOS devices

I would like to do data sharing(Maybe xml or json file) between 2 iOS devices (iPhone or iPad) and communication would be like "one to many bidirectional" bases at a time.
With some experience and from articles , I have found below ways to do it.
Wi-Fi Direct
AirDrop
Bluetooth(By creating Master and Slaves)
Bonjour SDK.
Bump API(Which is already closed from january 2014)
Could anybody please suggest the best way to fulfill my requirement, which is a good way to do it?
Since IOS 7 Multipeer Connectivity could also be quite interesting.
The Multipeer Connectivity framework provides support for discovering services provided by nearby iOS devices using infrastructure Wi-Fi networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and subsequently communicating with those services by sending message-based data, streaming data, and resources (such as files).
Here is a nice tutorial about implementing a file sharing system using multipeer connectivity:
http://www.appcoda.com/intro-ios-multipeer-connectivity-programming/
Wi-Fi
Connecting to your Personal Hotspot via Wi-Fi is the default option provided by Apple, since you have to specifically accept if you also want to enable the Bluetooth connection. A Wi-Fi connection provides:
Pros
High throughput: Throughput via Wi-Fi Personal Hotspot can be of around 30 Mbps between two devices and even more.
Faster: Connecting via Wi-Fi tends to be quite faster than connecting via Bluetooth.
Cons
Might need you to reconnect every time: Wi-Fi tends to be unstable and to turn itself off every time you put your iPhone to sleep. This means that you have to take out your iPhone and re-enable the Personal Hotspot if you want to connect.
Time limit: Perhaps the biggest drawback of using a Wi-Fi Personal Hotspot with your iPhone is that in order to minimize power consumption, your iPhone only gives you a short while (90 seconds reportedly) to connect a device to it after you enable Wi-Fi Personal Hotspot. If you take longer than that, you are forced to enable the option again.
More power consumption: The Wi-Fi Personal Hotspot consumes more power than its Bluetooth counterpart, which is also part of the reason it only gives you a short while to connect a device.
A bit more complex: The iPhone’s Wi-Fi Personal Hotspot requires you to enter a password and to configure your own security options.
Bluetooth
Contrary to the Wi-Fi connection, using your Personal Hotspot via Bluetooth offers some key advantages and one huge drawback:
Pros
No time limit: Once you enable Bluetooth Personal Hotspot, there is no time limit for you to connect your device to your iPhone.
Automatic pairing: Bluetooth remains dormant and ready to connect to your devices the moment you wake them up. Additionally, Bluetooth is more power-efficient than Wi-Fi.
Security handled automatically: The security level of a Bluetooth Personal Hotspot is equivalent to Wi-Fi’s WPA2, and it is all handled transparently from the moment you connect to it.
Cons
Very limited throughput: Without a doubt the biggest drawback of using a Bluetooth Personal Hotspot is its limited throughput, which can be of just 3 Mbps at the most, making it 10 times less than what your Wi-Fi Personal Hotspot can offer.

Is GSM data sending between 2 phones impossible?

Please tell me in detail why it is impossible to send the data between two phones over GSM? I can find almost no information about this problem.
There are 2 points here.
Firstly, GSM is a mobile voice telephony system - plain GSM doesn't do data connections.
GPRS and EDGE are add-ons to the GSM network that allow data to be sent.
There are other kinds of wireless phone networks that also use a SIM and allow data to be sent (UMTS, LTE).
Secondly, when you establish a data connection with a mobile phone and a phone network, you are establishing an IP connection between your phone/modem and a gateway server in the operator's network. The gateway server allows you access to the internet (together with the DNS server etc, obviously).
This is similar to a computer plugging in a LAN cable and connecting to their ISP. But you can also connect 2 computers with a crossover cable, and configure them to have an IP connection directly. So what you are asking is, why can't I do the same with 2 GSM phones? what is the equivalent of a wireless crossover cable?
The reason is because GSM has no protocol to connect phones to each other. It only defines a protocol for phones to connect to a network base station.
To transfer data between 2 phones, therefore, you need a different protocol, one which will work between 2 peers. Bluetooth is a common such protocol, but it only works over short distances.
If you want to connect 2 distant phones, you can do this via a third party, like a website, to which data can be uploaded into the cloud by the first phone and downloaded by the second phone.
Or, you could establish a connection at the IP level via the internet, e.g. if one mobile device was a web server (the last sentence is only theorising).
See also this related question
EDIT: 3GPP Release 12 includes direct Device to Device communications. At the time of writing, it's still very new, and not yet commercially available, so the answer above still holds. D2D is designed for emergency services, eg if the network is damaged by a disaster, they can still communicate directly. But 3GPP suggests that it will be commercially available as well. From 3GPP news
There are also commercial benefits of D2D, with new applications building on the physical proximity of users being trialed by operators.
2nd EDIT: Apple has created a feature called Multipeer Connectivity Framework, which uses a mixture of WiFi networks, peer-to-peer WiFi and Bluetooth to enable short distance connectivity between iPhones when there is no GSM network.
NFC is another peer-to-peer technology for communicating between 2 devices, that is supported by some phones. More information here.

GameKit peer to peer wifi without wireless router?

Thanks in advance for any thoughts about this. I'm looking for a way to do realtime inter-app communication in iOS via wi-fi (I need about 150 ft range and don't think bluetooth offers this) and wonder about the peer-to-peer connectivity offered by GameKit which, apparently offers both bluetooth and wi-fi connectivity. My question is: must participating devices be members of an available wireless network (via a wireless router) or is this connectivity truly peer-to-peer requiring no router?
I understand Wi-fi Direct is coming and would likely be an option. Just wondering if I can do this utilizing services available in iOS today.
Thanks!
Tim
A router is required for Wi-Fi connectivity. Bluetooth connectivity does not need one.

Resources