UDP works better when switching from one link to another. TCP is tricky with connection timeouts that makes the code wait and, possibly halt. This sketch uses TCP.
I guess there's some way to check if the TCP conn is unresponsive or a link goes down, close existing TCP conn, eventually switch to the other link, and open TCP again. Just don't ask me how to do it. ![]()