Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Length translation between tagged streams and PDUs #737

Closed
wants to merge 1 commit into from

Conversation

jacobagilbert
Copy link
Contributor

It appears the length of PDUs is in bytes and tagged streams are in samples. This creates issues when sending non-byte pdu data over networks. I don't know if this is the proper way to fix this, but it seems to resolve the issue. See my post here for an example: http://lists.gnu.org/archive/html/discuss-gnuradio/2016-02/msg00045.html

…hs (always in bytes) and tagged stream lengths (samples)
@jmcorgan
Copy link
Contributor

jmcorgan commented Feb 5, 2016

The flowgraph in the email is pretty clear about the bug. I'm looking into this.

@jmcorgan
Copy link
Contributor

jmcorgan commented Feb 6, 2016

The problem is in:

https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/socket_pdu_impl.cc#L196

Here, 'len' is assigned the return value from pmt::length(), which is in items, while everywhere after that it is treated as bytes. So the PDU is 512 items of floats, but only 512 bytes are written to the socket.

On the receiving end, the 512 bytes are pulled into a buffer of the appropriate length for 512 floats, but anything after that is garbage.

The fix in this PR is not the correct one; I'll open a new PR and reference this one.

@jmcorgan
Copy link
Contributor

jmcorgan commented Feb 6, 2016

Also, it appears we have an identical bug in pmt::print(), so it only displays the first 512 bytes of the PDU.

@jacobagilbert
Copy link
Contributor Author

Ok - thanks or figuring that out Jonathan. I wasn't sure where a fix should go but felt bad pointing out an issue with no suggestions.

It also appears that the UDP send function (https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/socket_pdu_impl.cc#L211) does the same thing, and the TCP server-side send function (https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/socket_pdu_impl.cc#L176) also has the same issue however the offending function is actually located at (https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/tcp_connection.cc#L54).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants