Debugging sending audio over TCP from rust forums [1] and gist [2].
[1]: https://users.rust-lang.org/t/data-become-corrupted-through-tcp/35462/3
[2]: https://gist.github.com/solindev/bf4d89b7f8adc2949ba5e300b73cf083/raw/f934cc71c69230bcf6fabf493b9265b88195271a/sender.rs
Simplified the gist to test only the TCP connection with a sequence of numbers.
- Create a new project with
cargo --bin --name projector some such. - Create folder
./examplesinside project. - Copy
sender.rsandreceiver.rsinto./examples.
cd project
diff -u <(sleep 1; cargo run --example sender) <(cargo run --example receiver)
- Without
sleep 1, sender will transmit numbers that are never received. - With
sleep 1, diff shows all bytes encoded and transfered without issue.