Hi, all. We have a camera with only one WiFi module. It supports AP and STA modes coexisting, but the WiFi of AP and STA can only be in the same channel at the same time, that is, 2.4G or 5G. In the initial state, the App is connected to the camera through 5G WiFi, and the camera is in AP mode. When entering the network configuration mode, the camera will start the STA mode, and the AP and STA modes coexist. When the user selects 2.4G WiFi, the AP mode will switch from 5G to 2.4G. Android's WiFi and socket are not disconnected, iOS's socket will be disconnected 100%, and WiFi may be disconnected. What is the reason for this? Is there any way to solve it?
Channel switching on the same WiFi causes Socket and WiFi disconnection
We captured some sniffer packets. it show iphone send the strange packets - Reassociation request. which is inconsistent with Android's behavior
When the user selects 2.4G WiFi, the AP mode will switch from 5G to 2.4G … iOS's socket will be disconnected 100%, and WiFi may be disconnected.
There’s two parts to this:
-
Why does the “socket” disconnect?
-
Why does the Wi-Fi disconnect?
I suspect that you care more about the second than the first. Unfortunately, I can’t help you with that. DevForums is primarily about APIs, and iOS has no APIs that operate at this level. If Wi-Fi isn’t behaving the way you want it to, I recommend that you file a bug about that.
If you do file a bug:
-
Make sure to installed the Wi-Fi debug profile, per the instructions on Bug Reporting > Profiles and Logs.
-
Please post your bug number, just for the record
Regarding the first question, it’s hard to answer that without knowing what you mean by “socket”. What API are you using to talk to your accessory?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
It’s better of you reply as a reply rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other tips.
For the socket, we use CocoaAsyncSocket, very simple code, like below:
OK.
Just FYI, we generally recommend that folks in your situation use Network framework. See TN3151 Choosing the right networking API.
You said that the socket disconnected but you only sent me a snippet of how you connect it. How is this disconnection reflected in your socket?
IMPORTANT I don’t maintain expertise in third-party libraries, so you’ll need to dig through the CocoaAsyncSocket code to determine which Apple API is triggering it to disconnect the socket.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"