# Stagnant connections shown in netstat

## voncloft

I attached a screenshot of connections that are still showing , even though my device 192.168.42.2 (my phone) is not at home - (I am at work right now)

Why is it still showing a connection when I am not home with it?

https://imgur.com/a/0MCy2iw

Also the :4040 is a subsonic service, and it is currently streaming outside my network to my phone - but it seems to never close a connection.

Thanks.

(Red blocks are external IP's that are blocked out for security reasons)

----------

## eccerr0r

TCP is known as a stateful connection.  However it requires packets to pass to control the connection.

If there are no packets flowing, and there doesn't need to be, the connection state table won't change, it assumes the device is still there even if it's not.  The software needs to detect and reap those connections, and if it doesn't know how to do that you'll have to restart the program.

----------

## zeek

Keepalives would get rid of these connections, but turning on keepalive can cause other problems so it isn't a default.  

Instructions: http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html

----------

## eccerr0r

This unfortunately depends on the software, if it does not have the capability to send keep alive packets, either you have to write them into the software or else you're still in the same boat...

----------

