in reply to Send over/print to socket at a specific rate

There's no way to directly set the transmission speed of a socket connection.  All you could do is to approximate the average speed by sending a 11025 x 16bits block once every second or similar (using a timer, and presuming the bandwidth of the connection is sufficient) — though I'm not really sure if this would help here...

I think you'll have to process the data on the receiving end instead (at 11025 x 16bits per second). The data on the socket will not come in faster than you're reading it.

What is the real problem you're trying to solve with your sending-at-a-specific-rate requirement?

  • Comment on Re: Send over/print to socket at a specific rate

Replies are listed 'Best First'.
Re^2: Send over/print to socket at a specific rate
by Illuminatus (Curate) on May 05, 2011 at 17:56 UTC
    Actually, if you are on Linux, this is not true. You can set the speed; it's just very painful, and you can't do it in perl (except via system calls). You can use tc to create a rate-shaping class on the interface you are writing to, along with a filter to force the packets of your socket into that class (if your destination has a fixed addr/port it is not that hard). Look here for an overview of how tc works. That said, I agree with Eliya that more definition of why this constraint is necessary to decide if this pain is worth it.

    fnord

      I wish I were on Linux. Normally I am, but this is Windows. It's for a test setup, so it's not critical. I'll just send the data in chunks with a timer as suggested. Thanks.