1b1994897Sopenharmony_ci# Communication between debugger and VSCode
2b1994897Sopenharmony_ciServer is an application that accepts commands through the socket and executes them in debugger
3b1994897Sopenharmony_ci
4b1994897Sopenharmony_ciCommand `ark --debugger --debugger-port=<port_number> --debugger-library-path=<path_to_debugger_library>`  launches debug server
5b1994897Sopenharmony_ci
6b1994897Sopenharmony_ci`--debugger-library-path` is an optional parameter
7b1994897Sopenharmony_ci
8b1994897Sopenharmony_ciVSCode provides us client interface and sending commands to the debugger with socket
9b1994897Sopenharmony_ci
10b1994897Sopenharmony_ci### Description of debug starting process
11b1994897Sopenharmony_ciServer side
12b1994897Sopenharmony_ci* Server creates a TCP socket for communication with client
13b1994897Sopenharmony_ci* Firstly server accepts a test client
14b1994897Sopenharmony_ci* Secondly server accepts a real client and debug session begins
15b1994897Sopenharmony_ci
16b1994897Sopenharmony_ciClient side
17b1994897Sopenharmony_ci* Client runs a server than waiting for a TCP socket
18b1994897Sopenharmony_ci* It's critical for VSCode to have a debug server initialized at allocated time so we establish a test connection firstly to check it
19b1994897Sopenharmony_ci* We create a test client every 100 milliseconds to check is socket ready for a debug session
20b1994897Sopenharmony_ci* When the connection is established (if it is at the allocated time) test client disconnects and real client connects to server
21b1994897Sopenharmony_ci* If connection was not established at the allocated time the `Can not launch debug server` error will be thrown
22