Checks if server is already running: first it tries to connect to server port if it is not successful it starts the server in a separate thread