Not able to view active servers through wifi and connect with it all the time by using Bonjour and NSNetServiceBrowserDelegate? - ios

i am working on an App that uses wifi network to pass data from one ipad to another ipads .
i have already referred the following sample code about:
http://mobileorchard.com/tutorial-networking-and-bonjour-on-ip
The above sample code connects Devices using wifi and can exchange messages using Cfnetworking and Bonjour.
My problem is that i am not able to see Active Servers all the time .While Some times it Shows me Active servers and i can easily connect with and Exchange Messages but when i relaunch or open the app after some time it doesn't show me active servers so i am unable to connect and exchange messages. The same problem occurs in the sample code available from above link having tutorial on to Send data over wifi to another Devices.
I am Stucked up over here where i am unable to connect with active Devices all the time because not able to access those servers.
In chatty sample code same problem occurs where you can see active chat room's and connect with but some times you will not be able to see those active chat rooms availabe even if there are active servers who have already started new chat room where all Devices are connected to same wifi network.
Any help would be highly Appreciable , Thanks in advance.

Any chance the wi-fi interface on the device is going to sleep from disuse? Or that the user roamed to a different Wi-Fi access point with the same name that isn't bridged via Bonjour?
Have you considered using Multipeer Connectivity instead of using Bonjour directly? IIRC, that API would let you communicate even if the devices are not on the same Wi-Fi network, which is probably what you want anyway.

Related

Connecting 30 iPads

I am currently programming an app for my school.
During the lesson the teacher needs to send and stream data to the students. There is a case in which one of the students streams the data to everyone else. The teacher uses an iPad and every student uses one.
My question is: How could this be realized without a local network or an internet connection?
Two solutions came to my mind when thinking about it:
Multipeer Connectivity. The problem with this solution is the limit to 8 devices. I have read that you can open multiple sessions at a time but I am worried that 30 devices are too many.
Having the teacher-iPad open a hotspot which the other iPads join. This hotspot will be used as a local network to communicate (as far as I know, this works on Minecraft PE). This would only be an option if the hotspot and it's password could be configured by the app, otherwise it would be too complicated to use in a lesson.
Thanks a lot for reading my text. I hope that you can help me.
Your devices need to transmit using wifi or bluetooth. I have a recollection that MCSession stopped being able to use bluetooth a few years ago. MCSession may work only if all devices are on the same wifi network.
Probably you can first use Multipeer Connectivity to setup the network, then use a hotspot or other solution afterward.
For example, using Multipeer Connectivity to send the wifi name and password to other devices. Once a device receives the setup information, you can disconnect it so that other devices can get connected.

Internet access between WiFi-IoT in Access Point mode with mobile phone connected

I did a lot of brain-storming about this, and couldn't reach a solution.
I am posting this as i can get some ideas.
I have developed a WiFi-IoT based device with sensor, which shows up in AP mode. A mobile phone connects to this AP and then the device starts sending sensor data to the mobile phone. A mobile application plots and displays this data.
Now, i want to send this data from mobile to internet. Connecting my mobile to another AP with internet is not an option, as i don't want to break the continuous data transmission.
Using internet of data provider is one option, but that brings constraint of have mobile data.
What other options do i have to send my data from mobile to internet ??
Edit:-
I worked on the suggestions, and came to this point:-
1) WiFi-IoT device (in station mode) and mobile phone connect to same Internet-enabled WiFi access point. WiFi-IoT device has the IP address of the mobile phone for current network, and sends data to a TCP port (eg. 9801) of this IP address. The application in mobile phone reads the data from the port no. 9801 and stores it and hosts it on the internet.
This works fine.
2)WiFi-IoT device comes up in Access Point mode, and the mobile phone connects to this Access Point. Now there is one-to-one connection between WiFi-IoT device and mobile phone.
My question is, in the second scenario, without breaking this one-to-one connection, is there way to host data to internet:-
1) without using mobile internet provided by mobile data service provider ?
2) without using a second mobile phone ?
I may be wrong, but i am just asking this to make be sure whether my requirement can be achieved or not !!
I don't think you can connect to two APs at the same time.
Maybe use Bluetooth as device to phone link?
Or have the device connect directly to internet after some config done in AP mode and then send a copy of the data to your phone app (either via WAN or locally to the private IP your phone gets from the Internet gateway AP)?
--Edit--
Let me explain about the second one:
What I mean is basically have your IoT device directly connect to Internet and send data to a server (your phone has also to be connected to Internet). Then make the server send a data copy back to your phone. It's two step process: 1) while the IoT device is in AP mode, use your phone to login and configure which Internet-connected AP it should be connected to. This serves as UI for your IoT device. 2) start sending data.
Or a bit ugly, just let the IoT device talk to your phone in the same WiFi network via private IP.
I brought up this way because you mentioned anyway your device has to send data to Internet(I assume it's a server) and have phone talk to a known location server is more portable and scalable once you have more than one IoT device.
--Further Edit--
I don't think there is a way to do what you described. At least from my experience:
1) on the link layer, the wireless NIC has to be able to connect to two APs at the same time. This is not a feature currently available.
2) on the network layer, there has to be two IP address attached to the same NIC, which I don't think is available in current OS for wireless NICs. Though there is a way to do this for Ethernet card, I.e. via Aliasing.

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.

Peer to Peer Communication without Server in iPhone

Is there any way to communicate between two devices or application with Browser of other devices without having Server in the middle?
If I explain, actually I want to share data between iPhone application and Browser of Desktop, I tried HTTPServer, & played with WebSocket too, but in these case this server plays an important role in between. So If somehow I exchange data between two peers like IP Address, Port number, Then Is it possible to communicate between those two devices using Wi-fi channel without having Server in Middle?
The Way, Right now I have implemented.
The way, I am looking for.
I recently came across http://www.freedomjs.org/ which is suppose to provide p2p functionality in the browser.

how to connect WiFi Direct Mobile phone to WiFi phone?

I was exploring regarding Wi-Fi Direct and came accross with conclusion that WiFi -certified devices can connect one-to-one or one-to-many and not all connected products need to be Wi-Fi Direct-certified. One Wi-Fi Direct enabled device can connect to legacy Wi-Fi certified devices.So by this we can conclude like if one device is having WiFi direct and other device is having Wifi one can easily connect to it.
I have following queries please help me to resolve.
1.This Wifi Direct is there in Android ICS onwards.So i am trying to connect WiFi Direct of my Samsung Note 2 having Jelly Bean with another Samsung Mobile Galaxy Y duos having Ginger Bread that only has WiFi but i am unable to detect? Can anyone help me in finding reason for this?
2.Another thing i studied is Wifi Direct device will become as access point means it will create an Ad-hoc network ? So why another Wifi devices are not detecting it?
To find a wifi direct device in access point list of a normal wifi u need to create a wifi direct group. For this you need to first connect two wifi direct devices out of which one will act as a group owner and other as client. Once a group is created group owner act as a normal access point for legacy devices(Wifi devices).
Thus you need to create a Wifi Direct group first

Resources