Rich> Hi there,
Rich> Is there any one out there who knows how to set time out for a
Rich> TCP/IP based server C program?
select() or alarm()?
Rich> Currently my server will hang forever if a client has an
Rich> inappropriate exit.
Not good :-)
There are two cases you need to consider:
- if the client process dies unexpectedly, closing or aborting the
- if the client host dies or becomes unreachable
Handling the first case is simply down to correct error handling. The
second case is harder; there's some discussion about it in the Socket FAQ
comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
or <URL: http://www.whitefang.com/unix/>