How to configure SO_KEEPALIVE for accept()

I would like to know how i can set the time of SO_KEEPALIVE, so that the program terminates when i remove the client’s connection … when the server is in a blocking function call…I am working on QNX 4.25…

This is a generic TCP/IP question. If you google for “socket FAQ” and then look for the question
“Why does it take so long to detect that the peer died”. You will get an explanation.

Bottom line: probably not a good idea to use KEEPALIVE, better to implemenent an application specific heartbeat.

Well, QNX 4 (I forgot from which tcpip version) support TCP_KEEPLIVE
option, which allowes application change that 2 hour into a different
value. To make a short timeout.