# How to close some ports opened by the gnuradio flowgraph?

**URL:** <https://www.ruby-forum.com/t/how-to-close-some-ports-opened-by-the-gnuradio-flowgraph/251471>\
**Category:** GNU Radio\
**Created:** [December 21, 2018, 10:36am UTC](https://www.ruby-forum.com/t/how-to-close-some-ports-opened-by-the-gnuradio-flowgraph/251471 "2018-12-21T10:36:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user123456789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/a88e57/32.png) [@user123456789](https://www.ruby-forum.com/u/user123456789)\
**Post date:** [December 21, 2018, 10:36am UTC](https://www.ruby-forum.com/t/how-to-close-some-ports-opened-by-the-gnuradio-flowgraph/251471/1 "2018-12-21T10:36:19Z")

</div>

I am designing some flowgraphs in gnuradio and then I am generating the python code. In this code I want to close all the sockets opened by the top\_block\_class instance (rpc and zmq sockets) to make a new object that can use the same sockets.

I think the sockets are opened with the following commands:

```auto
self.zeromq_push_sink_0_1_1 = zeromq.push_sink(gr.sizeof_gr_complex, 1, 'tcp://*:%d'%(zmq_p1), 1000, False)

self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(('192.168.0.10', server_port), allow_none=True)
self.xmlrpc_server_0.register_instance(self)
self.xmlrpc_server_0_thread = threading.Thread(target=self.xmlrpc_server_0.serve_forever)
 self.xmlrpc_server_0_thread.daemon = True
 self.xmlrpc_server_0_thread.start() 

```

The error returned is “Address already in use”
