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

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.

Related

Is it possible to utilize carrier data and WiFi connections simultaneously within an App?

The theory in question is that I have a device that emits its own WiFi network. In order to communicate with this device, you must be connected to that WiFi network, but as it does not provide internet, your connection options are blocked.
What would be ideal, is to connect to this device, collect data from it, and transmit/push this data to a server located online via whatever means.
This question has been asked before, but the responses and questions I found were a few years old, and the OS has been updated a few iterations since then.
Is it possible, via Swift or Objective C within a mobile iOS app to utilize the connection of WiFi, but use carrier data to transmit that collected data?
I would use the BlueTooth API for this. However, there are two restrictions: 1) you cannot connect to a BlueTooth device in a captive network, and 2) you will not be able to connect to Android devices via BlueTooth.

Communication over wifi or wirless access points in iOS device

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.

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.

What is AWDL (Apple Wireless Direct Link) and how does it work?

I'm trying to find out what AWDL is. On iOS, if you use Apple's peer-to-peer networking over BlueTooth, it seems Apple creates a new Network Interface "awdl0" to implement (I guess) IP-over-BT.
But I can't find any docs on this tech, or this interface, how it behaves, things we must / must not do with it, etc. Google comes up blank :(.
In particular, I believe it means "established a BT connection, and I'm running an IP bridge over the top, and you can use this to communicate peer-to-peer". Apple's own system libraries have bugs where this bridge isn't setup quickly enough, and if you send data too soon, it appears to get dropped by the OS. So ... if I can query this awdl0, I hope to check "are you ready yet?" and delay P2P messages until the OS is happy.
UPDATE
More info: I can get pairs of iOS devices to create awdl0 connections to each other - but they never get created to OS X machines, whether BT and Bonjour are on or not, whether the devices are paired or not.
Some background:
In iOS5, Apple permanently disabled the Bluetooth parts of Bonjour/Peer-to-peer networking, and published a technote instructing everyone to use DNS-SD if they wanted to keep using Bluetooth as a transport between iOS devices. This is fine, but it means you must use DNS-SD if you want high-performance BT, and you want it reliable.
(GameKit sometimes works fine, but we often see terrible performance in real-world scenarios, e.g. crowded public places - which goes away if you use DNS-SD)
DNS-SD protocol doesn't include info to tell you what the hardware is using. But it does tell you the Network Interfaces (which is how I know we're running on awdl0)
DNS-SD is awesome, and we have high-speed, low latency connections peer-to-peer between iOS devices - all the stuff that GameKit promises but often fails to deliver whenever there's more than a few wifi/BT devices in range.
AWDL recently caught a lot of attention when it caused Wi-Fi issues in iOS 8 and OS X Yosemite devices.
What is AWDL?
AWDL (Apple Wireless Direct Link) is a low latency/high speed WiFi peer-to peer-connection Apple uses for everywhere you’d expect: AirDrop, GameKit (which also uses Bluetooth), AirPlay, and perhaps elsewhere. It works using its own dedicated network interface, typically “awdl0".
While some services, like Instant HotSpot, Bluetooth Tethering (of course), and GameKit advertise their services over Bluetooth SDP, Apple decided to advertise AirDrop over WiFi and inadvertently destroyed WiFi performance for millions of Yosemite and iOS 8 users.
How does AWDL work?
Since the iPhone 4, the iOS kernels have had multiple WiFi interfaces to 1 WiFi Broadcom hardware chip.
en0 — primary WiFi interface
ap1 — access point interface used for WiFi tethering
awdl0 — Apple Wireless Direct Link interface (since iOS 7?)
By having multiple interfaces, Apple is able to have your standard WiFi connection on en0, while still broadcasting, browsing, and resolving peer to peer connections on awdl0 (just not well).
You can find more info here and here.
I'd like to provide a more precise answer as to how the protocol works internally. I quote part of the abstract of this paper.
In short, each AWDL node announces a sequence of Availability Windows
(AWs) indicating its readiness to communicate with other AWDL nodes.
An elected master node synchronizes these sequences. Outside the AWs,
nodes can tune their Wi-Fi radio to a different channel to communicate
with an access point, or could turn it off to save energy.
From a user perspective, AWDL allows a device remain connected to an infrastructure-based Wi-Fi network and communicate with AWDL peers "at the same time" by quickly hopping between the channels of the two networks (AWDL uses fixed social channels 6, 44, and 149). In contrast to the previous answer, we found that current versions of AWDL work fairly well and channel hopping only induces a small overhead.
Disclaimer: I'm co-author of this paper and we retrieved this information by means of reverse engineering. If you are interested in the details, please read the paper and have a look at the Wireshark dissector (published soon).

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.

Resources