fix TSocket.php while loop exception while connection failed