1
2
3
4
5import isystem.connect as ic
6
7
8def test_findExistingInstance():
9 print("Finding existing instance by ID...")
10 cfg = ic.CConnectionConfig()
11 cfg.instanceId("findExistingInstanceExample")
12 cfg.start_if_required()
13 connMgr = ic.ConnectionMgr()
14 connMgr.connect(cfg)
15
16 cfg2 = ic.CConnectionConfig()
17 cfg2.start_existing()
18 cfg2.instanceId("findExistingInstanceExample")
19 connMgr.disconnect_keep()
20 connMgr.connect(cfg2)
21 port = cfg2.getTCPPort()
22 if port > 0:
23 print(f"Instance found, port: {port}")
24 else:
25 print(f"Instance with ID 'findExistingInstanceExample' not found")
26
27
28
29
30 connMgr.disconnect_close(False)
31
32
33if __name__ == "__main__":
34 test_findExistingInstance()