Packet Flowgraph and underflows


I’ve been looking for a solution to this and can’t seem to find any

If I have a flowgraph that transmits packets for instance from a TCP
stream - if this TCP stream only receives data occasionally it will
create underflows (showing up as U characters on STDOUT).

What is the proper way of handling such a scenario? I thought of using
something like the Mute block to transmit a 0 data stream during
periods of no data. However that seems excessively complicated to
implement and I think I am missing some pointer here …


Hi Wolfgang,

no, you do not need to use something like a mute block.
The functionality you are looking for is already build into UHD (I’m
assuming you are using a USRP as your transmitting device)

The UHD sink in GNU Radio is able to react to some specific stream tags
one of which is the length tag.
You can assign a name for this tag in the UHD source block (‘Length tag
name’ field).

Now, if you have assigned a value to this ‘Length tag name’ field the
sink is somehow reacting as a tagged stream block [2].
If samples arrive at the UHD sink, the USRP will only transmit that
of samples specified in the length tag starting from that length tag.
Therefore, you should not see any ‘U’ messages no more as the USRP
automatically stops transmitting and does not expect any more samples

However, keep in mind that with tagged streams every first sample of a
‘packet’ needs to have the length tag attached.

E.g consider the following stream of samples where the first sample has
length tag assigned to it with value 10:

1 2 3 4 5 5 7 8 9 10 11
| |
length tag next length tag needs to be exactly here
value = 10 samples

Hope that helps.


Hi Julian,

Thanks for the pointer. I’m using a HackRF - doesn’t look like the
Osmocom sink supports the same construct. Any way of doing something
like this in a more generic approach?


Hi Julian,

Thanks for this - after a bit of googling I managed to find that as
well. Was a bit hard to get started but after fiddling with the block
buffers got it running the way I need it.

Also for reference - in the Osmocom sink the HackRF does not have the
payload length implementation based on tags yet. In case somebody else
should need it.


Hi Wolfgang,

sorry for the late reply.

I’m not familiar with the HackRF but something that might be useful for
as it makes burst mode transmissions in GNU Radio more generic and
independent is Eventstream by Tim O’Shea [1].
It should be exactly what you were looking for. It kind of implements
‘mute block’ concept you were talking about.

I hope that gets you started. Let me know if you have any more