Data Transfer between iOS and PC over WiFi - ios

I Need to create an iOS application and a PC application, the two need to be able to exchange data over Wi-Fi (either direct or via a wifi router).
The iOS app will act as a remote control for some of the features of the PC app, for instance, if a video is playing on the pc application then the iOS app will have buttons to control playback on the PC such as play, pause, stop etc, when one of these buttons is pressed then I need to send some bytes to the pc over wifi.
My questions are:
how should I go about sending data - Wifi direct or via wifi network that both devices are connected to?
can anyone help with example code to connect or send data to a specific device over wifi for either methods?
to be clear, I don't need help with creating the applications themselves - only the wireless transfer of data between the devices using the Wi-Fi radio whether it be direct or via a router.
The main question: is it possible to initiate a connection/send bytes under iOS over wi-fi to a pc on the same network or via wifi direct?
Help with the method to do this or example code would be helpful.

Related

iOS: Use WiFi and Mobile Data simultaneously

Setup:
My project involves a WiFi Camera which creates a WiFi hotspot. In order to stream video preview/browse media on the Camera, the user needs to connect to Camera's hotspot.
Problem:
The user cannot use the cellular data over 3G/4G simultaneously, as the iOS device is already connected to the camera via WiFi.
What I have tried? / Investigations
Customizing WiFi hotspot by setting Static IP, Subnet Mask and leaving all other fields empty. This works as expected, iOS connects to the internet via Mobile Data showing the 3G connection, also connects to WiFi silently.
This solution needs to show details to the user how he needs to configure WiFi network connection, which is not user-friendly.
MultiPeer Connectivity
Possible only with Apple devices
What do I want?
Is there any way to do this programmatically?
(I want to submit to App Store - No private API)
Is there any alternative to this?
Any other direction to solve this problem?

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.

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

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.

Connect an Ipad to a controller

I need to run an application in my ipad which has to talk wirelessly to a controller. The controller communicates on serial as well as RS485 port. It doesn't have a wifi adapter.
What are the options for me to do this ?
One thought is, I have to buy a wifi to RS485 adapter which I will attach to my controller and then my ipad can connect to the controller through the wifi adapter. Is this feasible? My doubts are because, I am not sure whether Ipad has the capability to open a raw socket connection to the remote wifi adapter (on the controller).
If not, then what are the other options which are available for me ?
If you are comfortable with fairly straight forward electronics and programming, this is how I would do it.
I would forget about having them talk directly and instead use the internet, you can get cheap controller called an Electric Imp that you can create code for using their online portal to connect your device to the internet, the device itself connects up using wifi and its own secure VPN.
Once you have it connected up you can create you own webpage or app to talk to their cloud, this has the added advantage you can now control your device wherever you can get an internet connection and your device can continue to interact to the internet even when your ipad is off.
http://electricimp.com

Resources