diff --git a/apps/EchoClient.cpp b/apps/EchoClient.cpp index bd4551d381ecf6178744a6096044008f4f1e7b1e..43dc49f35ee927cf833b895e529b64de57f08ab5 100644 --- a/apps/EchoClient.cpp +++ b/apps/EchoClient.cpp @@ -10,11 +10,12 @@ #include <algorithm> // for find #include <atomic> -#include <cerrno> // for errno, ECANCELED -#include <chrono> // for nanoseconds, duration, durat... -#include <cstdint> // for uint64_t, int32_t -#include <cstdlib> // for size_t, strtol, exit, EXIT_F... -#include <cstring> // for memcmp +#include <cerrno> // for errno, ECANCELED +#include <chrono> // for nanoseconds, duration, durat... +#include <cstdint> // for uint64_t, int32_t +#include <cstdlib> // for size_t, strtol, exit, EXIT_F... +#include <cstring> // for memcmp +#include <iomanip> #include <iostream> // for operator<<, basic_ostream, endl #include <string> // for allocator, string, char_traits #include <thread> @@ -177,18 +178,21 @@ static void clientFunc(uint64_t client_id, Semaphore& readySem, Semaphore& start } if (memcmp(outBuf, inBuf, size) != 0) { - std::cerr << "got unexpected echo from server" << std::endl; - std::cerr << "expected: " << std::hex; + std::stringstream sst; + sst << "got unexpected echo from server" << std::endl; + sst << "expected: "; for (unsigned i = 0; i < size; ++i) { - std::cerr << (unsigned)outBuf[i] << " "; + sst << std::setfill('0') << std::setw(2) << std::hex << (0xff & (unsigned)outBuf[i]); } - std::cerr << std::endl; + sst << std::endl; - std::cerr << "received: " << std::hex; + sst << "received: "; for (unsigned i = 0; i < size; ++i) { - std::cerr << (unsigned)inBuf[i] << " "; + sst << std::setfill('0') << std::setw(2) << std::hex << (0xff & (unsigned)inBuf[i]); + sst << (unsigned)inBuf[i] << " "; } - std::cerr << std::endl; + sst << std::endl; + std::cerr << sst.str(); DIE; }