# Issue about message port of grextras

**URL:** <https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593>\
**Category:** GNU Radio\
**Created:** [April 22, 2014, 11:11am UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593 "2014-04-22T11:11:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [April 22, 2014, 11:11am UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593/1 "2014-04-22T11:11:16Z")

</div>

Hi all,

Recently I am learning the grextras project. I am confused about the  
message port which is designed in grextras.  
Why will we not get a error when the message ports do not connect to  
other message ports? I thought those port actually is data stream ports,  
so they should be connected to other ports.

Best regards,  
Damon

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 23, 2014, 3:51pm UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593/2 "2014-04-23T15:51:36Z")

</div>

On Tue, Apr 22, 2014 at 5:09 AM, Damon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

Damon,  
grextras is an external project from GNU Radio and not related to the  
core  
functionality.

But GNU Radio’s message passing structure does not require connections.  
It’s a publish-subscribe model, and a block will publish a message  
regardless of whether or not another block is subscribed and listening.

Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 24, 2014, 6:03am UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593/3 "2014-04-24T06:03:04Z")

</div>

Hi Tom,

Thanks for you reply.

I am wondering why the data stream ports of byte or integer 8 could be  
disconnected by other ports.

Here is an example. The connecting code is commented out, but we can run  
this program without getting a error.

#!/usr/bin/env python  
##################################################

# Gnuradio Python Flow Graph

# Title: Top Block

# Generated: Thu Apr 24 11:57:08 2014

##################################################

from gnuradio import blocks  
from gnuradio import eng\_notation  
from gnuradio import gr  
from gnuradio.eng\_option import eng\_option  
from gnuradio.filter import firdes  
from optparse import OptionParser

class top\_block(gr.top\_block):

```
def __init__ (self):
    gr.top_block. __init__ (self, "Top Block")

    ##################################################
    # Variables
    ##################################################
    self.samp_rate = samp_rate = 32000

    ##################################################
    # Blocks
    ##################################################
    self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
    self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)

    ##################################################
    # Connections
    ##################################################
    #self.connect((self.blocks_null_source_0, 0),

```

(self.blocks\_null\_sink\_0, 0))

# QT sink close method reimplementation

```
def get_samp_rate(self):
    return self.samp_rate

def set_samp_rate(self, samp_rate):
    self.samp_rate = samp_rate

```

if **name** == ‘ **main** ’:  
parser = OptionParser(option\_class=eng\_option, usage=“%prog:  
[options]”)  
(options, args) = parser.parse\_args()  
tb = top\_block()  
tb.start()  
raw\_input('Press Enter to quit: ')  
tb.stop()  
tb.wait()

Best regards,  
Damon

2014-04-23 21:46 GMT+08:00 Tom R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 25, 2014, 4:45am UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593/4 "2014-04-25T04:45:44Z")

</div>

On Thu, Apr 24, 2014 at 12:01 AM, Damon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> #!/usr/bin/env python  
> from gnuradio.filter import firdes  
> self.samp\_rate = samp\_rate = 32000  
> #self.connect((self.blocks\_null\_source\_0, 0),
> 
> Best regards,  
> Damon

I really don’t understand the question. Why do you think this behavior  
is  
wrong? There are no blocks in the flowgraph; that’s not a condition to  
say  
it won’t run. When you hit start, it’ll try to start all threads; there  
are  
none, so it will immediately exit. The raw\_input is a Python thing, so  
that  
will continue to block.

Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 25, 2014, 8:17am UTC](https://www.ruby-forum.com/t/issue-about-message-port-of-grextras/240593/5 "2014-04-25T08:17:33Z")

</div>

I got it. If the message port defined in grextras is disconnected, the  
message sink or source block will not in the flowgraph.  
Thanks Tom.

Best regards,  
Damon
