Gleb Smirnoff wrote:
On Fri, Oct 07, 2005 at 05:04:40PM +0300, Lefteris Tsintjelis wrote:
L> >You are expecting wrong from these socket options. They do not specify
L> >time after which socket should be closed, if no IO is done.
L>
L> Is there any easy build in functionality for that?
Pardon, but I do not understand the question.
He wants the connection to be closed after a certain number of seconds if it is
idle.
Lefterius, when you read() from the socket, call time(). If you read more than
zero bytes, save that time in a variable. If you read zero bytes, compare what
time it is now to the saved value, and if the delta is greater than when you
want an idle connection to close, well, call close() and exit or whatever.
Details like initializing the variable to now beforehand are probably needed.
--
-Chuck
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"