If you can’t modify the server side program,
You can try method ① but, It has some risk.
Some risk are the chip is blocked at tx buffer memory full.
But , If you send a data and recevie a ack to the sent data after sending a keep alive packet, the chip maybe operated nomally.
I do not know what will be solved by method ①.
I just hope to solve your problem.
Thank you.