Re: setsockopt and SO_RCV/SNDTIMEO

From: Chuck Swiger (cswiger_at_mac.com)
Date: 10/07/05

  • Next message: Brooks Davis: "Re: Switching from RELENG_4 to newer Release that supports ia64"
    Date: Fri, 07 Oct 2005 11:31:22 -0400
    To: Gleb Smirnoff <glebius@FreeBSD.org>
    
    

    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
    _______________________________________________
    freebsd-stable@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-stable
    To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
    

  • Next message: Brooks Davis: "Re: Switching from RELENG_4 to newer Release that supports ia64"

    Relevant Pages

    • Re: Definition of NULL
      ... Charlie Gordon wrote: ... >>myFuncand myFunc2equivalent in functionality)? ... > array to all bits zero has been addressed thoroughly in other posts, ... that instead to relate to the allocation of the buffer space. ...
      (comp.lang.c)
    • Re: NESTED IF FUNCTIONS
      ... trying to do is expand the functionality to include cupons and/or sales. ... zero where I wrote "something"; I presume it was intended to be a ... Avoid unnecessary parentheses. ... Only use SUM() to compute a sum of its parameters or a range; ...
      (microsoft.public.excel.worksheet.functions)
    • Re: [take24 0/6] kevent: Generic event handling mechanism.
      ... Evgeniy Polyakov wrote: ... kevent_ctlwith zero number of ready events, ... >> Rather than mark an existing entry as ready, ... >> type of functionality we'd need to use indirect notification via ...
      (Linux-Kernel)
    • Re: [take24 0/6] kevent: Generic event handling mechanism.
      ... Usually this is done with a *_wait call with a timeout of zero. ... thread itself does not sleep and can process events), ... This would be useful to implement functionality at userlevel and still use an event queue to announce the availability. ...
      (Linux-Kernel)
    • Re: Computing infinity modulus and zero modulus
      ... And - I beg your pardon again, I promise this is the last for tonight ... please forget my rumination about oo drawn at zero: ...
      (sci.math)