# Find a Packet in a bit stream

**URL:** <https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028>\
**Category:** GNU Radio\
**Created:** [November 12, 2014, 10:05am UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028 "2014-11-12T10:05:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [November 12, 2014, 10:05am UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028/1 "2014-11-12T10:05:08Z")

</div>

Hi,  
How to tell my receiver to identify a specific packet through a received  
bit stream?  
I transmit a custom packet (with header, payload, crc16).  
Is there any block in gnuradio that I can use for this purpose?  
I had a look on “Packet Header parser” and “parser sink” blocks, but I  
did’t understand how to use them.  
Any direction or examples will be very helpful for me.

Thank you  
Daniel

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 12, 2014, 10:57am UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028/2 "2014-11-12T10:57:40Z")

</div>

Hi Daniel,

I think looking at the gr-digital/examples/OFDM example flow graphs will  
help you.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 12, 2014, 11:25am UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028/3 "2014-11-12T11:25:09Z")

</div>

Thank you Marcus,  
I need something like the header/payload demux block.  
Can you help my understand how it works?  
The trigger input value can be the starting byte of my packet?  
In header\_data input should I insert the expected header?  
Is it possible to have a variable length payload?  
Instead of defining the length of the frame is it possible to set a byte  
as the end of my frame?

Thank you in advance!  
Daniel

On Wednesday, November 12, 2014 11:56 AM, Marcus M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

Hi Daniel,

I think looking at the gr-digital/examples/OFDM example flow graphs will  
help you.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 12, 2014, 11:38am UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028/4 "2014-11-12T11:38:53Z")

</div>

Hi Daniel,

On 11/12/2014 11:23 AM, Daniel B. wrote:

> I need something like the header/payload demux block.  
> Can you help my understand how it works?  
> Well, depends 😉 First, I’d point you to the obvious source, the  
> documentation for header\_payload\_demux [1] and especially the “Detailed  
> Description” section. That will explain your following quistions:  
> The trigger input value can be the starting byte of my packet?  
> (kind of)  
> In header\_data input should I insert the expected header?  
> (no)  
> Is it possible to have a variable length payload?  
> (yes)  
> Instead of defining the length of the frame is it possible to set a byte as the  
> end of my frame?  
> (no, I think that’s the job of the header to define. Packeted  
> transmission with end-of-transmission symbols don’t really make sense,  
> imho)

header\_payload\_demux does really what its name promises: Given a sample  
stream and information about packet starts (either via input stream or  
by using trigger\_tag\_key tags). The packet detection is something you’ll  
have to do “upstream” in the flow graph.  
I really like to do that, so here I’m pointing you at the official  
documentation for packeted data transmission.

Greetings,  
Marcus

> Thank you in advance!  
> Daniel

[1]

> **[GNU Radio Manual and C++ API Reference: gr::digital::header\_payload\_demux...](https://www.gnuradio.org/doc/doxygen/classgr_1_1digital_1_1header __payload__ demux.html)**

[2] [http://gnuradio.org/doc/doxygen/page\_packet\_data.html](http://gnuradio.org/doc/doxygen/page_packet_data.html)

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 12, 2014, 12:08pm UTC](https://www.ruby-forum.com/t/find-a-packet-in-a-bit-stream/233028/5 "2014-11-12T12:08:43Z")

</div>

Hi Marcus,

thank you again for your useful recommendations.

Cheers!

On Wednesday, November 12, 2014 12:37 PM, Marcus M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

Hi Daniel,

On 11/12/2014 11:23 AM, Daniel B. wrote:

> I need something like the header/payload demux block.  
> Can you help my understand how it works?  
> Well, depends 😉 First, I’d point you to the obvious source, the  
> documentation for header\_payload\_demux [1] and especially the “Detailed  
> Description” section. That will explain your following quistions:  
> The trigger input value can be the starting byte of my packet?  
> (kind of)  
> In header\_data input should I insert the expected header?  
> (no)  
> Is it possible to have a variable length payload?  
> (yes)  
> Instead of defining the length of the frame is it possible to set a byte as the  
> end of my frame?  
> (no, I think that’s the job of the header to define. Packeted  
> transmission with end-of-transmission symbols don’t really make sense,  
> imho)

header\_payload\_demux does really what its name promises: Given a sample  
stream and information about packet starts (either via input stream or  
by using trigger\_tag\_key tags). The packet detection is something you’ll  
have to do “upstream” in the flow graph.  
I really like to do that, so here I’m pointing you at the official  
documentation for packeted data transmission.

Greetings,  
Marcus

> Thank you in advance!  
> Daniel

[1]

> **[GNU Radio Manual and C++ API Reference: gr::digital::header\_payload\_demux...](https://www.gnuradio.org/doc/doxygen/classgr_1_1digital_1_1header __payload__ demux.html)**

[2] [http://gnuradio.org/doc/doxygen/page\_packet\_data.html](http://gnuradio.org/doc/doxygen/page_packet_data.html)
