# Writing Blocks - Problem with I/O Count

**URL:** <https://www.ruby-forum.com/t/writing-blocks-problem-with-i-o-count/239946>\
**Category:** GNU Radio\
**Created:** [March 21, 2014, 6:28am UTC](https://www.ruby-forum.com/t/writing-blocks-problem-with-i-o-count/239946 "2014-03-21T06:28:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 21, 2014, 6:28am UTC](https://www.ruby-forum.com/t/writing-blocks-problem-with-i-o-count/239946/1 "2014-03-21T06:28:00Z")

</div>

I’m writing a (allegedly simple) block to frame incoming bytes with a  
3-byte header, and append to them a one-byte CRC. One input port, one  
output port. Problem is, my sent message will look something like  
“testtesttesttest”, and, after packetizing, it looks like  
“HEYtest1HEYtest1HEYHEYHEYtest1”, where HEY is my header, and 1 is my  
crc (for now). I suspect that the block variable “noutput\_items” is not  
correct - but I have no way to prove this theory. I saw some source for  
a similar block which did some modification on this variable inside the  
general\_work function.

I am confused most about this variable being passed in to the general  
work function, yet also being returned from the same function. Who  
passes it to my function, and how is it determined before I actually do  
the general\_work?

Thanks,  
Stephen A.
