E
Eric
I have a server (NT service) that listens on multiple ports, some use
asynchronous methods and some synchronous methods for reading and writing to
and from the sockets.
I could really benefit from timed server events. For example, say I wanted
to disconnect a user who has idled at a login prompt for over 3 minutes. Or,
to perform some maintenance after a week has passed. Or, limit sessions by a
specified time frame.
I am wondering, what is the best and most efficient solution to achieving
this? I have solved it using various methods (such as threads running in
infinite loops, a shared timer created in its own thread, etc). But I am
just wondering what is the most efficient solution from the opinions of
developers.
Previously, I used socket time outs (each socket would time out after a half
a second while waiting for data, then it would wait again) which was very
efficient since it had to be done anyway. During each time out, I would
check time stamps to see if a specified time frame has elapsed. This was
great, but now I handle sockets at a much lower level so it is not feasible
to do anymore.
A timer for each user or each socket would not be feasible either, since
there are potentially hundreds of users connected at any given time.
So, any ideas on what the best possible practice may be?
Thanks so much in advance.
asynchronous methods and some synchronous methods for reading and writing to
and from the sockets.
I could really benefit from timed server events. For example, say I wanted
to disconnect a user who has idled at a login prompt for over 3 minutes. Or,
to perform some maintenance after a week has passed. Or, limit sessions by a
specified time frame.
I am wondering, what is the best and most efficient solution to achieving
this? I have solved it using various methods (such as threads running in
infinite loops, a shared timer created in its own thread, etc). But I am
just wondering what is the most efficient solution from the opinions of
developers.
Previously, I used socket time outs (each socket would time out after a half
a second while waiting for data, then it would wait again) which was very
efficient since it had to be done anyway. During each time out, I would
check time stamps to see if a specified time frame has elapsed. This was
great, but now I handle sockets at a much lower level so it is not feasible
to do anymore.
A timer for each user or each socket would not be feasible either, since
there are potentially hundreds of users connected at any given time.
So, any ideas on what the best possible practice may be?
Thanks so much in advance.