Task: on the computer when launching a remote application, check the availability of the remote application server and if the verification is successful, launch the application. The easiest way to send an echo request to a remote server. But this method is not the best since the server or service can hang or even an echo request can be denied in the firewall. Putting your application to open a socket on a terminal server is not an option.
Tell me how you can check the availability of the server on the port (in this case 3389)