As the Title already says im looking for a way, to get notified when a client closes his Session unnormal.
I'm using the freeBSD OS. The server is running with Xamount threads (depending on CPUcore amount). So I'm not forking, and there isn't a own process for each client.
That's why sending an deathpackage all time_t seconds, to recive a SIGPIPE isn't an option for me. But i need to remove left clients from the kqueue, because otherwise after too many accept()'s my code will obviously run into memory troubles.
Is there a way, I can check without high performance loose per client, they are connected or not?
Or any event-notification, that would trigger if this happens? Or maybe is there a way of letting a programm send any signal to a port, even in abnormal termination case, before the Client process will exite?
According to the kqueue man page,
kevent()
should create an event when the socket has shutdown. From the description of th filterEVFILT_READ
: