I have a socket that connects to a TCP server using either Wifi or 4G signal that receives a PING every 5 minutes from the server. But if I turn Wifi off on the device, I would like the socket to detect this and reconnect using a 4g signal. I was wondering if there was a way to reconnect the socket automatically to 4G if I go out of the range of the wifi or if I turn wifi off?
Also is there a way to go the other way as well(From 4g to wifi if the wifi is available?