On your laptop, edit the ssh_config file to send null packets to the server at some interval. This way, you will not lose the connection.
1. Open the ssh_config file in an editor.
vi /etc/ssh/ssh_config
2. Add the following line at the end of the file. This change will send null packets to the server every 60 seconds.
ServerAliveInterval 60
If you have "root" privileges on the server machine, make similar changes in the ssh_config file on the server. Thus, if you are not connecting from your laptop, you will not have to worry about timeout.