src/LineIO.php
public function write()
    {
        if (!count($this->sndQueue)) {
            return false;
        }

        $line   = array_shift($this->sndQueue);
        $logger = \Plop\Plop::getInstance();

        // Make sure we send the whole line,
        // with a trailing CR LF sequence.
        $eol    = $this->eol[count($this->eol) - 1];
        $line  .= $eol;
        $len    = strlen($line);
        for ($written = 0; $written < $len; $written += $fwrite) {
            $fwrite = @fwrite($this->socket, substr($line, $written));
            if ($fwrite === false) {
                return false;
            }
        }
        $line = substr($line, 0, -strlen($eol));
        $logger->debug(
            '%(line)s',
            array('line' => addcslashes($line, "\000..\037"))
        );
        return $written;
    }
public function write()
    {
        if (!count($this->sndQueue)) {
            return false;
        }

        $line   = array_shift($this->sndQueue);
        $logger = \Plop\Plop::getInstance();

        // Make sure we send the whole line,
        // with a trailing CR LF sequence.
        $eol    = $this->eol[count($this->eol) - 1];
        $line  .= $eol;
        $len    = strlen($line);
        for ($written = 0; $written < $len; $written += $fwrite) {
            $fwrite = @fwrite($this->socket, substr($line, $written));
            if ($fwrite === false) {
                return false;
            }
        }
        $line = substr($line, 0, -strlen($eol));
        $logger->debug(
            '%(line)s',
            array('line' => addcslashes($line, "\000..\037"))
        );
        return $written;
    }
public function write ( ) { if ( ! count ( $ this -> sndQueue ) ) { return false ; } $ line = array_shift ( $ this -> sndQueue ) ; $ logger = \ Plop \ Plop :: getInstance ( ) ; // Make sure we send the whole line, // with a trailing CR LF sequence. $ eol = $ this -> eol [ count ( $ this -> eol ) - 1 ] ; $ line .= $ eol ; $ len = strlen ( $ line ) ; for ( $ written = 0 ; $ written < $ len ; $ written += $ fwrite ) { $ fwrite = @ fwrite ( $ this -> socket , substr ( $ line , $ written ) ) ; if ( $ fwrite === false ) { return false ; } } $ line = substr ( $ line , 0 , - strlen ( $ eol ) ) ; $ logger -> debug ( '%(line)s' , array ( 'line' => addcslashes ( $ line , "\000..\037" ) ) ) ; return $ written ; }
Writes a single line from the output buffer
to the socket.

\retval int
The number of bytes successfully
written on the socket.

\retval false
The connection was lost while trying
to send the line or the output buffer
was empty.
Writes a single line from the output buffer to the socket .