Cellular for internet, WIFI for printing

iPad app at a client location normally uses WIFI for internet. It uses the local LAN via WIFI to connect to Epson printers that are all have static IP addresses on the LAN. Having virtually 100% connectivity to the internet is quite important, so I started exploring whether or not we could use WIFI for internet+printing when internet is reachable by WIFI, then cellular for internet and WIFI for printing when WIFI internet is down.


I was told that this was looked into in the past, and "its not possible". Googling seems to imply that this is the same response others have gotten. In our system:


- LAN usage is always to statically allocated addresses known at launch

- WIFI always uses URLSessions to a small number of URLs providing cloud services


Is there really no way to make this work?


Also, the WIFI could go up and down over time - we'd be using cellular for backup purposes mostly.

Accepted Reply

Do you have flexibility with regards the API you use for printing? That is, are you going to writing the low-level networking code yourself? Or are you printing via some high-level API where the underlying networking code is hidden from you?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

I think there are two different points here:

  • The device should be automatically switching from wifi to cellular as it detects connectivity.
  • You don't get much say in the matter for some of the higher level API. Especially if you're trying to disagree with the system for when to call the wifi "down" to cause the switch over.

But I assume the sticking point for you is that the device doesn't want to stay in a situation where:

  • Global network access through cellular interface
  • Local network (not connected to global) access through wifi.

unless the device has something like wifi-assist turned on (that feature setting where cellular is used to supplement slow or poor wifi connections). And even then, I'm not sure if the switch over points are going to be where you want them to be.

The primary issue is getting printing over WIFI to work when the iPad automatically switches to cellular due to no internet through the WIFI network.

Do you have flexibility with regards the API you use for printing? That is, are you going to writing the low-level networking code yourself? Or are you printing via some high-level API where the underlying networking code is hidden from you?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Excellent point and I should have made it earlier in the original post. Nope - its a 3rd party library from Epson.

Nope - its a 3rd party library from Epson.

OK, that limits your flexibility somewhat.

The main sticking point you’ll encounter here is the lack of auto join. iOS will not automatically join a Wi-Fi network that doesn’t lead to the Internet (actually, it may join the network but it will then leave again once it determines that it doesn’t lead to the Internet). So, to be able to talk to a local service over Wi-Fi while using WWAN to access the wider Internet, you’ll need to:

  • Manually join the Wi-Fi (A)

  • Use whatever API you want to access the Internet; WWAN will be the default route (B)

  • Code carefully to ensure that your local connections go via Wi-Fi (C)

Point A is the real challenge. By “manually join” I mean “the user has to got to Settings > Wi-Fi and choose the network” [1]. Moreover, if the device leaves the Wi-Fi — for example, when the user locks the screen — the user has to manually do it again.

This is particularly problematic if the standalone Wi-Fi uses static IP. Things will go more smoothly if the accessories on that network support Bonjour, namely:

The complexity of point C depends on your specific requirements. If the outgoing connection target’s an IP address on the Wi-Fi’s subnet, any API should work. If not, you have to specifically bind the connection to the interface, and most of our high-level APIs (and I expect your third-party library) don’t support that.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] Joining via

NEHotspotConfigurationManager
may also work; I’ve not tried that yet.