Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:14:57+00:00 2026-06-07T17:14:57+00:00

I am receiving a stream of const char* msg types of a certain size_t

  • 0

I am receiving a stream of const char* msg types of a certain size_t len. At some byte offset within there there is a sequence number (32 or 64 byte, im not sure which) so my idea was to do the following every time I get one of the msg things:

for (int i = 0; i < 30; ++i)
{
    uint32_t seq = *(uint32_t*) msg[i];
    cout << "seq" << i << " " << seq << endl;
}
//and similar for 64 bytes

so that afterwards I can group the lines with the same offset and see which offset i is giving me sequential looking output. The problem with this is that I segfault with stuff like:

(gdb) p *(uint32_t*) msg[i]
Cannot access memory at address 0x2d

How can I carry out my little search idea for the sequence numbers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:14:59+00:00Added an answer on June 7, 2026 at 5:14 pm

    Try:

    uint32_t seq = *(uint32_t*) &msg[i];
    

    and

    (gdb) p *(uint32_t*)&msg[i]
    

    EDIT: A bigger change, which is potentially more portable is:

    uint32_t seq;
    memcpy(&seq, msg + i, sizeof(seq));
    seq = ntohl(seq);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm receiving an H.264 stream from a DVR using its SDK. There were memory
I am reading data from a TCP/IP stream and am successfully receiving a byte
I am receiving a stream of unordered Int32 values and need to track the
I have a DirectShow source filter for receiving a Network stream containing RFC2435 data
Let's say I'm receiving a file over a socket stream, I am receiving 1024
I am receiving shouldstartloadwithrequest event and I need to stop request for some conditions.
Here's my scenario ... I will be receiving a stream of individual messages from
I am trying to do some manipulations on images using OpenCV. I am receiving
I am developing an android application which receiving the video stream from a server.
I am currently not receiving the last object from my object stream until another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.