B
Bernard Chan
Hi All,
I am writing a script to generate some packets for RTP stream simulation. As
you may know, RTP requires a more-or-less constant packet rate (and hence
UDP is used), and I will need to generate fixed sized packets at regular
intervals, say 20ms, so that will be around 50 packets per second.
On Linux I have tried a version using Time::HiRes ualarm(). On some of my
Linux systems ualarm() can generate a packet rate that approximates 50Hz
pretty well, and the interval variance is infinitesimal. However, I also
have some systems (mostly Fedora) which seem to exhibit increasingly long
intervals after some seconds for reasons unknown to me.
I would also like to have the script usable on Windows that my peers who
have Windows on their systems can perform some tests. There is no ualarm()
in Time::HiRes on Windows, so I tried another approach. I created a
thread-enabled version of the script. A separate thread is created which
does roughly this:
while ($continue) {
sendPacket();
select(undef, undef, undef, 20/1000);
}
However, I find that the sleep between each packet tends to be slightly
higher than 20ms, so after not many packets it is already arriving slower
than the drain rate at the receiver side.
So, I would like to know, whether I can do anything to improve this on the
Windows side? I don't need microseconds or even nanoseconds granularity.
1ms would be generally good enough, but I would like a cross-platform
(Win+Linux at least) approach.
Any insights will be much appreciated.
I am writing a script to generate some packets for RTP stream simulation. As
you may know, RTP requires a more-or-less constant packet rate (and hence
UDP is used), and I will need to generate fixed sized packets at regular
intervals, say 20ms, so that will be around 50 packets per second.
On Linux I have tried a version using Time::HiRes ualarm(). On some of my
Linux systems ualarm() can generate a packet rate that approximates 50Hz
pretty well, and the interval variance is infinitesimal. However, I also
have some systems (mostly Fedora) which seem to exhibit increasingly long
intervals after some seconds for reasons unknown to me.
I would also like to have the script usable on Windows that my peers who
have Windows on their systems can perform some tests. There is no ualarm()
in Time::HiRes on Windows, so I tried another approach. I created a
thread-enabled version of the script. A separate thread is created which
does roughly this:
while ($continue) {
sendPacket();
select(undef, undef, undef, 20/1000);
}
However, I find that the sleep between each packet tends to be slightly
higher than 20ms, so after not many packets it is already arriving slower
than the drain rate at the receiver side.
So, I would like to know, whether I can do anything to improve this on the
Windows side? I don't need microseconds or even nanoseconds granularity.
1ms would be generally good enough, but I would like a cross-platform
(Win+Linux at least) approach.
Any insights will be much appreciated.