[Android-development] Network interface selection

Benjamin TERRIER b.terrier at gmail.com
Fri Jul 29 16:47:55 CEST 2016


Hi,

I am developing an Android application with Qt that need to
communicate with a device over wifi.
However the wifi network is not connected to the Internet, so Android
keep 3G modem as the default interface.

As I'm using QTcpSocket, I thought about using QTcpSocket::bind() to
force the socket to use the wifi interface without success. In fact,
it seems the wifi interface does not have an IP address (checked via
Qt API and via Android settings) so I cannot bind to it. (NB: the wifi
router shows an IP associated with the Android wifi MAC address).

Is there a way to force activate the wifi interface and get its IP address ?

Thanks

BR

Benjamin



More information about the Android-development mailing list