The following program demonstrates how to convert byte endianness in Rust. It consists of a client and server. The client sends a number, and the server squares that number. The numbers are sent in big-endian byte order.
To run, the server, enter cargo run --bin server; to run the client, enter cargo run --bin client.
This zip file contains the complete crate.