3

I'm looking for a way to transfer a file over UDP at an specific bitrate. I can use netcat for example like this:

cat file | nc -u 192.168.x.x 5000

And I use a custom application to listen at port 5000 at client side.

Is there any way to "cat a file raw to udp" at a specific bitrate?

dawud
  • 14,918
  • 3
  • 41
  • 61
user185165
  • 31
  • 1
  • 2

1 Answers1

7

PV (Pipe Viewer) has the ability to rate-limit a pipe.

pv -L 512k

-L RATE, --rate-limit RATE Limit the transfer to a maximum of RATE bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote kilobytes (*1024), megabytes, and so on.

You can either install it from source from here or install it with a package manager for your distribution.

So you'd do:

cat file | pv -L 512k | nc -u 192.168.x.x 5000
Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148