TeamSpeak3/Transport/TCP.php
public function readLine($token = "\n")
    {
        $this->connect();

        $line = StringHelper::factory("");

        while (!$line->endsWith($token)) {
            $this->waitForReadyRead();

            $data = @fgets($this->stream, 4096);

            Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);

            if ($data === false) {
                if ($line->count()) {
                    $line->append($token);
                } else {
                    throw new Ts3Exception(
                        "connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost"
                    );
                }
            } else {
                $line->append($data);
            }
        }

        return $line->trim();
    }
public function readLine($token = "\n")
    {
        $this->connect();

        $line = StringHelper::factory("");

        while (!$line->endsWith($token)) {
            $this->waitForReadyRead();

            $data = @fgets($this->stream, 4096);

            Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);

            if ($data === false) {
                if ($line->count()) {
                    $line->append($token);
                } else {
                    throw new Ts3Exception(
                        "connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost"
                    );
                }
            } else {
                $line->append($data);
            }
        }

        return $line->trim();
    }
Reads a single line of data from the stream.

@param  string $token
@throws Ts3Exception
@return StringHelper