I want to create a TCP client that maintains a reliable connection to a TCP server over WiFi. When WiFi drops the code should retry re-connections to WiFi. When TCP connections are dropped, the TCP client should attempt to reconnect. All this should be in a non-blocking manner (e.g. in a thread). When data is received this data should be made available to the main thread.
I am struggling to find concrete examples or documents on how to achieve this sort of thing. Does anyone know of any recommended approaches, or examples to achieve this sort of thing?