# Gr-ctrlport and multiple applications

**URL:** <https://www.ruby-forum.com/t/gr-ctrlport-and-multiple-applications/228994>\
**Category:** GNU Radio\
**Created:** [May 15, 2013, 10:43am UTC](https://www.ruby-forum.com/t/gr-ctrlport-and-multiple-applications/228994 "2013-05-15T10:43:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![copot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/49beb7/32.png) [@copot](https://www.ruby-forum.com/u/copot)\
**Post date:** [May 15, 2013, 10:43am UTC](https://www.ruby-forum.com/t/gr-ctrlport-and-multiple-applications/228994/1 "2013-05-15T10:43:20Z")

</div>

Greetings,

Today, we can configure gr-ctrlport to use a specific port. Doing so  
leads to a problem when trying to execute more than one gnuradio  
application even if they are not explicitly using controlport. The  
first application will take control of the network socket and the  
second will fail to start with:

RuntimeError: Network.cpp:1104: Ice::SocketException:  
socket exception: Address already in use

According to Ice documentation, I can specify a different  
configuration file for each application using ICE\_CONFIG environment,  
but this seems to be overruled by the gnuradio runtime.

Is there a way to configure controlport so that application A uses one  
port, application B uses another port, etc.?

Is it possible to disable controlport at runtime?

Alex

---

<div class="post-metadata">

**Author:** ![copot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/49beb7/32.png) [@copot](https://www.ruby-forum.com/u/copot)\
**Post date:** [May 15, 2013, 7:03pm UTC](https://www.ruby-forum.com/t/gr-ctrlport-and-multiple-applications/228994/2 "2013-05-15T19:03:01Z")

</div>

On Wed, May 15, 2013 at 9:42 AM, Alexandru C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> According to Ice documentation, I can specify a different  
> configuration file for each application using ICE\_CONFIG environment,  
> but this seems to be overruled by the gnuradio runtime.
> 
> Is there a way to configure controlport so that application A uses one  
> port, application B uses another port, etc.?
> 
> Is it possible to disable controlport at runtime?
> 
> Alex

You can configure ControlPort through the preference files and set  
enable/disable in ~/.gnuradio/config.conf using:

[ControlPort]  
on = True

The ‘config’ option allows you to point to an ICE configuration file,  
where you can define endpoints. One thing here is that you don’t need  
to set a port number for your endpoint, at which point it will select  
an ephemeral port for you for each ControlPort app that’s launched.  
You can also not use a configuration file, and in this case, again, it  
will find an open ephemeral port and enable it on all current  
interfaces.

For programmatic control over if ControlPort is enabled/disabled in  
your application, you can set the environmental variable. In Python, I  
do it this way:

os.environ[‘GR\_CONF\_CONTROLPORT\_ON’] = ‘True’ (or ‘False’)

The environmental variables will override any settings in config.conf  
or the installed gnuradio-runtime.conf settings and are checked every  
time you query the preferences.

You should also be able to use:

gr.prefs().set\_string(‘ControlPort’, ‘On’, ‘False’)

I’m not sure if how we have it set up allows you to easily set  
different endpoints to different apps. Like I said, you can not  
specify the port, and it will select one for you. But if you want to  
control this for many different applications, maybe the best way is to  
set the GR\_CONF\_CONTROLPORT\_CONFIG variable (or with the  
set\_string(‘ControlPort’, ‘Config’, ‘FILENAME’) method) for each  
application to point to your different ICE config files.

Tom

---

<div class="post-metadata">

**Author:** ![copot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/49beb7/32.png) [@copot](https://www.ruby-forum.com/u/copot)\
**Post date:** [May 16, 2013, 10:48pm UTC](https://www.ruby-forum.com/t/gr-ctrlport-and-multiple-applications/228994/3 "2013-05-16T22:48:47Z")

</div>

On Wed, May 15, 2013 at 7:01 PM, Tom R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > socket exception: Address already in use  
> > Alex  
> > an ephemeral port for you for each ControlPort app that’s launched.  
> > The environmental variables will override any settings in config.conf  
> > control this for many different applications, maybe the best way is to  
> > set the GR\_CONF\_CONTROLPORT\_CONFIG variable (or with the  
> > set\_string(‘ControlPort’, ‘Config’, ‘FILENAME’) method) for each  
> > application to point to your different ICE config files.

Hi Tom,

Thanks for the info. I tried setting GR\_CONF\_CONTROLPORT\_ON and it  
works just fine.  
I will also try GR\_CONF\_CONTROLPORT\_CONFIG later.

Alex
