How can i detect my microcontroller with wifi shiled in my local network? - wifi

I have an microcontroller that is connected to my local wlan via a wifi shield. Since the controller always gets a different ip adress everytime it connects, i cant relieably detect it in my network. I know that i could assign always the same ip adress via the router configuration but i dont want to have to change the router config everytime i bring this device to a new network. Therefore the app i am developing should be able to detect the controller in the wifi automatically. It must be possible somehow since google chromecasts also dont have to be configurated in the router all the time. And the apps can aldo detect it in the same network. How can i archieve this behaviour of finding a device in the same network?

Related

Detect when a device with a certain MAC address connects to my LAN on IOS

I am trying to trigger an event when a device with a certain MAC address connects to my LAN. Is this possible in IOS? According to some research the device I want to detect (Amazon Dash Button) performs and ARP ping to the router to connect, then triggers a hard coded HTTP request. I want to detect the ping through my IOS app so that I can trigger an event via my phone.
The most helpful resource I have found so far is this repository:
LAN-Scan
However, this is run everytime the user invokes it. Is there a way o constantly scan the local network trigger some code when a new device connects?
Any and all help is appreciated.

Is there a way to programmatically change network routes on an iOS device?

Scenario: I want to have an iOS device connect to a LAN that has no upstream Internet connection, yet still retain and use its cellular data connection.
Theoretically, it strikes me that the iOS wifi NIC and the cellular data NIC are similar enough to dual NICs in a PC that I should be able to set up routing such that any request to, say, 192.168.. goes through the wifi connection, and any other request goes through the cellular data connection.
I did a test to see if both NICs are active when the iOS device is connected to wifi by the following steps.
Ensure that my iPhone's wifi is off and that I have a good cellular data connection.
Disconnect my wifi router's Ethernet cable to my cable modem.
Connect my iPhone to the wifi router.
Use another iPhone that's connected only via cellular data to create a game of Words with Friends.
As soon as the other iPhone completed the first move, my iPhone received a notification that there was a new game to play.
This confirmed that the cellular data connection was indeed alive and well enough to receive push notifications despite the wifi NIC's being connected.
The question becomes, then, can an app programmatically connect to a given wifi network, set the cellular data network to be the default route, and route any requests to, say, 192.168.. to go through the wifi network?
I know this post is old, but I happen to have done some work on using multiple network interfaces on iOS.
My experiments showed that accessing via hostname results in iOS choosing the network interface it wants to use, and not trying any further interfaces if the host cannot be resolved.
If you know the DNS Server IP address for any Ethernet/WiFi based network, you can send a DNS request yourself, convert the hostname into an IP address and access via IP address. iOS will then use the correct interface.
My guess is, that if you have the private class IP address space accessible over both connections, there's probably nothing you can do to specify which network interface should be used.

Controlling default gateway on iOS

I need to connect an iOS device (iDevice) to a WiFi access port but keep using the cellular data connection.
Default behavior is for iOS to set the WiFi connection as the default gateway, routing all internet traffic there. In my case the access point is a black box device supplying a WiFi network to access it's services, but not the internet.
One solution which we have tried, is to make the iDevice the access point (hot spot) and have the black box device connect though it. This is far less desirable as the black box device has no UI. So it is difficult to setup. We have lessened the pain by using Bonjour but still...
Is it possible to make a system call (iOS application) to restore the gateway setting back to the cellular gateway after the iDevice joins a WiFi network?
Would be even better if there is some way to setup the iDevice (IPhone or IPad) to maintain it's cellular gateway after connecting to a WiFi access point.

Force iOS device app to talk through the local WIFI network

I'm building an application that will run in a museum with a local area wifi network without internet access, for some strange reason I'm not able to fully "join" this network with an iOS device. Enabling internet access on this network solves the problem...
The network should provide only a web server and a DNS server, the access point has a DHCP server, android devices can connect to the network without problems.
When I try to join the network with the device it remains in a "spinning wheel" status, the DHCP server log on the debian server says it has assigned an address to the iOS device, and if I check for the wifi address with an application (like iSys o SBSettings) I see the WIFI DHCP assigned address.
But when my app (or safari) tries to connect to the web server the request is routed through the 3G connection and not completed.
In my app I'm using the standard "Reachability" framework from Apple to check the reachability of a provided host name through the wifi connection and I get 0 on the SCNetworkReachabilityFlags mask....
I'm quite sure the problem is due to the fact iOS (5.1 in my case) tries to check the reachability for some "standard" host in the network, before routing traffic through the WIFI connection.
Anyone knows what an iOS device do to "validate" a WIFI network? I can add hostnames or simple dummy services to the server machine if this can help me connect the device to a LOCAL-only network :)
It seems that iOS doesn't like to join networks without a gateway, also if the network is local you have to setup a correct gateway address.
Setting the gateway as the server itself did the trick and the device started to route TCP/IP over my local area wifi network.

How can I broadcast data between the same app but on different ipad's within a common LAN

I want to be able to have multiple iPads on a single LAN running the same app each with the ability for peer to peers broadcast.
This needs to be peer to peer broadcast (serverless) or if I have to, then I can designate one app as the local server to receive and resend events. But the information should never leave the LAN (so no cloud server).
A simple example would be an app that has a single button. Each instance of this app would be configured with a unique ID (say 1-10). When any user touches that button anywhere on the LAN all the other iPads running this app would display the number of the app instance elsewhere on the LAN where the button has been pushed.
This seems like it should be a basic capability but I am having a hard time finding if it is even possible in IOS. Can anyone confirm that it is and how to do it?
You could set it to broadcast on the broadcast ip of the lan. and use it like a multicast address.
ex. 192.168.1.0/24
broadcast/listen on 192.168.1.255
the only downfall is that it will be sent to every device on the lan.
[edit] vv
or if you designate one as the server you could advertise the servers ip address as a broadcast.

Resources