Search code examples
iossocketscellular-network

How to send data over Cellular Network when Wi-Fi is also connected in IOS


I am working on an ios app in Which I need to send data always over Cellular Network whether the device is connected to Wi-Fi or not.If Wi-Fi is not connected then everything works well but When Wi-Fi is connected then the data goes through the Wi-Fi channel,which I think is the default channel for data transmission in case it is in connected state.How can I force data to be sent over cellular network when Wi-Fi is also connected and active.

I dont't want to prompt the user to disable the Wi-Fi.


Solution

  • There is no way of doing this on high-level APIs. Based on other similar questions here on stack, you will have to find the wwan interface which is normally 'pdp_ip0' and bind to its address.

    You might find some hints here, here and here.

    You may want to have a look at this as well

    Hope this helps