winIDEA SDK
test_start_new_instance.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6import time
7
8
9def test_startNewInstance():
10 print("Starting new instance with ID: 'startNewInstanceExample'...")
11 connMgr = ic.ConnectionMgr()
12 cfg1 = ic.CConnectionConfig()
13 cfg1.instanceId("sdk_example")
14 cfg1.cmdLineParams("/LOG:6")
15 connMgr.connect(cfg1.start_always())
16 port = cfg1.getTCPPort()
17 print(f"\tInstance created, port: {port}")
18 connMgr.disconnect_keep()
19
20 cfg2 = ic.CConnectionConfig()
21 cfg2.processTCPPort(port)
22
23 connMgr.disconnect_keep()
24 connMgr.connect(cfg2)
25 print(f'\tWinIDEA is connected: {connMgr.isConnected()}.')
26 connMgr.disconnect_close(False)
27
28
29if __name__ == "__main__":
30 test_startNewInstance()