Automatic connection and disconnection

 
I have to disconnect from the server for a certain period of time.
During this time, the parameters are automatically optimised. During this time, however, no signal may arrive from the server.
Afterwards, the connection should be re-established.
Is there a programmable solution for this?
Reason: