Why does my session disconnect after a certain period of idle time?

If your PC is not used for a certain period of time, the connected Xshell session is disconnected and the following message appears.

Connection closed by foreign host.

Or

Socket error Event: 32 Error: 10053.
Connection closing...Socket close.
Connection closed by foreign host.


This indicates that the Xshell sessions was closed because the network connection was lost.

This usually occurs when the network device loses power when the PC enters sleep mode and the network connection is lost. In the Windows settings, set the option to not shut off power for the network device even when entering power saving mode.


Control -> ... -> Device manager -> Network adapters : Properties of the relevant network device
(Win+R => devmgmt.msc)


Turn off the option: (Allow the computer to turn off this device to save power)