Relatively basic echo client/server. Sends a custom struct back and forth.
Both client, server, and shared data structures are setup as separate packages in a single Cargo workspace
(named client, server, and shared, respectively).
You can run the server (with logging information displayed) from the root of this workspace with:
RUST_LOG=info cargo run -p serverOnce the server is started, you can run the client with:
cargo run -p clientThe server accepts command line arguments to set the address and port to listen on (defaults to 127.0.0.1:8080).
The client accepts command line arguments to set the address and port to connect to, as well as the integer and string to send in the message.
Note that command line args must be passed to an app running in cargo after a --. E.g., to listen on IPv6:
RUST_LOG=info cargo run -p server -- -a ::1Core functionality is from standard library modules:
std::net: SpecificallyTcpListenerandTcpStreamstd::thread: For handling client connections on the server
Also pulls from several crates: