diff --git a/examples/connect_discover_read_tags.py b/examples/connect_discover_read_tags.py index 6bdc4bc..aaa182e 100644 --- a/examples/connect_discover_read_tags.py +++ b/examples/connect_discover_read_tags.py @@ -51,6 +51,8 @@ def main(): start = time.time() properties = opc_client.properties(tags) print(f'{n} {time.time()-start:.3f}s {properties}') + opc_client.close() # Remote call OpcDaClient. close() + opc_client._pyroRelease() # release the pyro connection if __name__ == '__main__': diff --git a/openopc2/gateway_proxy.py b/openopc2/gateway_proxy.py index ca87ecd..89112f9 100644 --- a/openopc2/gateway_proxy.py +++ b/openopc2/gateway_proxy.py @@ -26,9 +26,9 @@ def __init__(self, host: str = 'localhost', port: int = 7766): register_dict_to_class("exceptions.OPCError", OPCError.dict_to_class) def get_server_proxy(self): - with Pyro5.client.Proxy(f"PYRO:OpenOpcGatewayServer@{self.host}:{self.port}") as open_opc_gateway_server: - return open_opc_gateway_server + open_opc_gateway_server = Pyro5.client.Proxy(f"PYRO:OpenOpcGatewayServer@{self.host}:{self.port}") + return open_opc_gateway_server def get_opc_da_client_proxy(self): - with Pyro5.client.Proxy(f"PYRO:OpcDaClient@{self.host}:{self.port}") as opc_da_client_proxy: - return opc_da_client_proxy + opc_da_client_proxy = Pyro5.client.Proxy(f"PYRO:OpcDaClient@{self.host}:{self.port}") + return opc_da_client_proxy