Scan local network to detect windows/mac/linux computers with iPhone - ios

I'm trying to figure how to perform some networking tasks using Objective C on the iPhone. I'd like to enumerate all network devices on my local, home network. Also, I'd like to be able to ping individual devices.
Does anyone know how and what tools/libraries I can use to achieve this and other networking tasks? I've checked the iPhone library and found solutions for devices that use Bonjour. I'd like to be able discover and ping devices that don't use Bonjour.

You might be able to get somewhere with Windows networking (SMB), but most services use Zeroconf (what Apple calls Bonjour).

Related

How can I scan for all IPs of devices connected to the network using Apple's Network Framework?

I want to scan for any device found in the network my device is currently connected to. I want to find their IP address and possibly more information so I can present the user a list of all devices in the network providing as much details as possible.
I have found example using getifaddrs. They kind of work, but, I am unable to see all of the devices I can see with an app like IP Scanner on the Mac app store.
In the process I have learned that the new Framework Apple is pushing is the Network framework.
I haven't been able to find many examples on how to possibly build an IP scanner using the Network framework. I think I may be able to achieve that using NWBrowser, but I am not sure as that seems to be strictly a Bonjour play.
Does anyone have example I could follow to learn how to build an IP scanner using the new Apple Network Framework?

See devices connect to my wifi router using Swift and allow/block wifi acces

In short i'm trying to build an App that will grant/block wifi access to my son's wifi for his Ipad and his PS4 remotely using an App. I researched the topic and can't figure out how this can be done. Ideally i'd like to be able to grant/block wifi access independently Ie. block wifi to the Ipad and allow PS4.
How can this be done, no need for the full code ( well if you insist i'll take it ) but just point me in the right direction.
Depending on the router you're using you're going to need to write something that interacts with the router's API, if it has one. If it doesn't, you will need to replace the firmware on your router with something like ddwrt that can be scripted. From there, you might be able to create an app that talks to the router's API.
TLDR: You're probably better off simply bookmarking the management page for the router and enabling/disabling access for the devices.
Edit:
It occurred to me that some mainstream consumer router/access point manufacturers (Linksys, Asus, etc) have companion apps for managing their devices from the LAN side. You should see if such an app exists for your router, and if not, perhaps consider getting a different router that supports such an app.

What's the best way to exchange data between devices locally?

I want to send data from 4-7 iPads to a MacBook and back for an application I plan on making that uses all devices and I want to avoid using a server for exchanging data. Also I would like to avoid connecting the devices over a local wifi network, as I would like my application to work regardless of wifi availability.
Is there a way of doing this using Bluetooth or a wired solution? Or maybe something else?
I think your best way is using apple Multipeer Connectivity, you can connect up to 7 nearby devices via Bluetooth, Wifi, or creat a local Wifi: https://developer.apple.com/reference/multipeerconnectivity

inconsistent result from bonjour service in iPhone

In my iPhone/iPad app there is need to display list of devices connected the my router. Please refer the image the as shown below.
But problem is I do not get consistent result for example sometimes bonjour will detect 3 devices where-in actually it would be connected to 5 devices to router.
Is there any better alternative to bonjour to achieve the same functionality. Please suggest/advice on this.
Also it detects only iPhone/iPad devices only connected to network not any android devices connected to the same router.
Thanks
Bonjour is a good and fast approach, but it will only detect the devices that support Bonjour.
You could try to ping every device on the local network. The challenge here would be to determine the start and end IP addresses. It's pretty easy and this answer explains it very well.
You'll need to get the subnet mask and this is how you can do it on iOS.
This method is not going to work all the time and it will take 3-4 seconds to complete. This is why Bonjour (or other ZeroConf implementations) is really cool and useful for fast local device discovery.

Is it possible to make one iPhone discover other devices on the same local network?

Let's say you have five devices on the same local network. Is it possible for iOS device 1 to act as a central hub and "discover" the other four devices on the same network and communicate with them, almost acting like a server. Do we just need to find some unused port and communicate over it? Is this possible from a HTML5 web app, or would a native app be required?
I never done it with ios device.
but if your point is to "discover" or scanning network using web app..then it is possible.
I've done a multi tier web app which has a server that has to scan a local network to find it's child just by using php. There are many parameter that you can use to determine the discovered device is your target or not.

Resources