snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

Is it possible to enable TCP keepalive in snapserver side?

Open yangsongx opened this issue 2 years ago • 1 comments

Hi there,

This project is so cool. I found the default socket is TCP keepalive disabled. Therefor, if some clients connections were dis-connected un-expectly(such as unplug the network cable), the connection would be kept by system(where snapsever was running on) unless the snapserver restarted, or the unplugged network cable re-connected.

I am wondering if we can enable the TCP keepalive, to let snapserver be able to disconnected those zombie connection after the idle timeout, instead of keeping those connections.

Thanks

yangsongx avatar Feb 28 '22 06:02 yangsongx

I was wondering the same.

Most of my snapclients are ESP32-based devices that I just power on and off. so there's no proper disconnect by the snapclient. These clients are shown as online until the connection gets closed by the OS, I think the default TCP keepalive is 7200s on Linux systems.

Apart from TCP keepalive, wouldn't the server be able to detect disconnected clients anyway due to IO-errors on the TCP socket? It could then close the connection from its side and mark the client status as offline.

kuema avatar Mar 27 '24 08:03 kuema