Added some code to prevent connecting more than once to the TS3 server.