Created
June 21, 2019 03:33
-
-
Save paulvictor/031f82ea038fa4b340ab75e220cdb1c1 to your computer and use it in GitHub Desktop.
Simulating a stream from a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| i=0 | |
| ratePerSecond=1000000 | |
| port=5000 | |
| ratePerMS=$(($ratePerSecond/100)) | |
| while [ true ] | |
| do | |
| toRead=$((i*$ratePerMS)) | |
| b=`head $toRead $1 | tail -$ratePerMS` | |
| i=$((i+1)) | |
| echo $b; sleep 0.01 | |
| done | nc localhost $port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment