check connection script

  • How to check is script connected to server succesfully?
    I use:
    $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
    $tsAdmin->connect();
    $test = $tsAdmin->connect();
    print_r($test);


    But i have an error: Array ( [success] => [errors] => Array ( [0] => Error: the script is already connected! ) [data] => )
    :(