In general, no. The responsibilities of the programmer and protocol developer must determine, implement and apply any timeouts at the application level.
However, all kinds of things can lead to malfunctions and other problems associated with a network connection. It is not possible to determine if the TCP connection is inactive, or if the other end is unavailable if you are not trying to send something.
For this reason, most servers with long-standing connections contain simple polls, such as sending empty packets, or such each so often to detect a lack of connection.
Will
source share