The stupid question is the question not asked | |
PerlMonks |
Re: Limit Socket (throttle) to send specific ammount of packets every secondby kcott (Archbishop) |
on Sep 22, 2016 at 08:10 UTC ( [id://1172349]=note: print w/replies, xml ) | Need Help?? |
G'day Lucas, Welcome to the Monastery. Firstly, you can put long tracts of code within <readmore>...</readmore> or <spoiler>...</spoiler> tags: see "Writeup Formatting Tips" for details. Unfortunately, without seeing the surrounding code, it's difficult to tell what additional code will be appropriate. There may well be better solutions! The following demonstrates how you might achieve what you ask using an alarm (actually, it uses Time::HiRes's ualarm for finer granularity).
Here's a sample run:
Notes:
See also: "perlipc -- Perl interprocess communication". Update: s/last unless eof/last if eof/ — Ken
In Section
Seekers of Perl Wisdom
|
|