I have a C program that uses epoll_ctl.
It waits for connections on a specific port, and when a device connects it determines if the device needs an updated firmware version or not. If it does, it sends the firmware version found on the linux host.
Where I am having trouble is detecting if the device receiving the update disconnects abruptly.
As I need to know this as the server only allows x# of devices to connect and then when the 1 device connects that exeeds this limit I need to restart the service. But only if I know that no devices are getting updates at the time.
I tried checking EPOLLRDHUP but this doesn't seem to work reliably. Any help would be appreciated thanks.