htons and htonl cause portability problems. std::endian will resolve them. Will be implemented after introducing C++20.