Re: Timeout for AsyncSocket
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/19/04
- Next message: Joseph M. Newcomer: "Re: Creating Slider on Modeless dialog"
- Previous message: Joseph M. Newcomer: "Re: Dynamic change of dialog controls' properties"
- In reply to: pnigl: "Timeout for AsyncSocket"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Feb 2004 03:51:14 -0500
Easy. Set a timer handler. When the timer fires, check a flag that says whether or not
there has been any activitiy. If it is false, close the socket. Any time you receive
something, set the flag to true. When the timer fires, set the flag to false. If the timer
fires twice in a row with false, it means there was no intervening activity. (There are
more complex things, such as setting a 1-second timer, and coutning how many seconds have
gone by with no activity, but those are just fancy twiddles of the base algorithm).
joe
On 18 Feb 2004 06:47:06 -0800, pnigl@gmx.de (pnigl) wrote:
>I have a big problem with my C++ SocketServer Program...
>For the Connection I used an Asyncsocket and I'm using OnConnect and
>OnAccept for the Communication. Now the problem is, that the
>ClientSocket, which is connected, has the abandonment to close the
>Connection. If the Client doesn't close it, the Server waits to long
>until he closes the connection (after timeout)...
>
>Now my Question: "How can I make a timeout, after the connection is
>established??? (10 second timeout)"
>
>Thanks in Advance...
>
>Peter
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Joseph M. Newcomer: "Re: Creating Slider on Modeless dialog"
- Previous message: Joseph M. Newcomer: "Re: Dynamic change of dialog controls' properties"
- In reply to: pnigl: "Timeout for AsyncSocket"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|