How is loss of a TCP connection detected, and handled so that another connection can be made?

We have an embedded Linux kernel module that listens for connection from a remote GUI,
and if the GUI disconnects, then the embedded needs to be able to listen and connect again.

Should it use shutdown()?