How to close some ports opened by the gnuradio flowgraph?

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:

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(('', server_port), allow_none=True)
self.xmlrpc_server_0_thread = threading.Thread(target=self.xmlrpc_server_0.serve_forever)
 self.xmlrpc_server_0_thread.daemon = True

The error returned is “Address already in use”

1 Like