Will It Blend? - TCP Streams
Find a file
2026-03-13 22:46:01 +00:00
src reduce test duration from 5 seconds to 1 2026-03-13 22:46:01 +00:00
.gitignore initial commit 2026-03-13 22:04:46 +00:00
Cargo.lock initial commit 2026-03-13 22:04:46 +00:00
Cargo.toml initial commit 2026-03-13 22:04:46 +00:00
LICENSE add license 2026-03-13 22:07:15 +00:00
mise.toml initial commit 2026-03-13 22:04:46 +00:00
README.md initial commit 2026-03-13 22:04:46 +00:00

TCP Sprint

This script demonstrates the risk of interleaving writes when cloning TcpStream handles across threads, re: this discussion in the Servo Zulip.

It works by spawning 3 threads: 2 TCP clients, each of which sends predictable chunks of bytes over a shared connection with TcpStream::write_all(), and 1 TCP listener, which tests whether messages arrive contiguously or scrambled together.

Messages consist of the range 0x00..=0xff, repeated to fill the desired message size.

Usage

cargo run <message size in bytes>