Search code examples
c++packetace

Problem with showing my packets in console with ACE


for Debug reasons i want to show my outgoing packets in Console. The packets arrive at the server correctly btw. But if i want them to show in Console before sending, then it is showing just nothing:

    ACE_Message_Block *m_Header;

    ...

    size_t send_len = m_Header->length(); // Size of the Message Block

    char* output = m_Header->rd_ptr();
    printf("Output: %s", output); // Trying to show it in Console
    // Send it
    server.send(m_Header->rd_ptr(), send_len);

Someone has an idea?


Solution

  • Likely the data you send contains 0's - and you'll need to append a newline as well.

    for (size_t i = 0; i < send_len; ++i) {
      if (output[i]<32) {
        printf("\\x%02hhx", (unsigned char) output[i]);
      } else {
        printf("%c", output[i]);
      }
    }
    printf("\n");