On 1/24/06, Jeff Pang <[EMAIL PROTECTED]> wrote:
> hi,lists,
> I want to do this work: count something in continuous given time piece,such 
> as 10
> minutes.Fox example,there are the lines coming to the socket server as 
> following:
>
> 1_feifish1_01_1000ybyg:11530514:get
> 1_swm_mail_01_100k8qte:13901448:get
> 1_dajia###_01_1006x8jh:11652267:put
> ...
> each line is split to 3 fieles: uid,size,type
>
> The socket server accept these lines continuely.I want the result: some a uid 
> such as
> '1_swm_mail_01_100k8qte',when his total size are plus to some a number (fox
> example,20000000) in the past 10 minutes,then I would do something.But I have 
> no
> idea about how to do the count in continuous time piece.Is there any 
> suggestion
> here?thanks.
snip

If you have access to whatever is writing to the socket then the
safest thing to do is to add a timestamp that the message was sent. 
Otherwise you will need to maintain the timestamp of the arrival of
the message.  See the select function on (perldoc -f select) how to
only execute when data is available.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to