protected function sendToClient($line)
    {
        $bytes = 0;
        $len   = strlen($line);
        if ($len) {
            while(true) {
                $sent = socket_write($this->client, $line, $len);
                if (false === $sent) {
                    throw new Exceptions\HttpStatusError(
                        "Internal server error.",
                        500
                    );
                }

                $bytes += $sent;
                if ($sent < $len) {
                    $line = substr($line, $sent);
                    $len -= $sent;
                } else {
                    break;
                }
            }
        }

        return $bytes;
    }
protected function sendToClient($line)
    {
        $bytes = 0;
        $len   = strlen($line);
        if ($len) {
            while(true) {
                $sent = socket_write($this->client, $line, $len);
                if (false === $sent) {
                    throw new Exceptions\HttpStatusError(
                        "Internal server error.",
                        500
                    );
                }

                $bytes += $sent;
                if ($sent < $len) {
                    $line = substr($line, $sent);
                    $len -= $sent;
                } else {
                    break;
                }
            }
        }

        return $bytes;
    }
protected function sendToClient ( $ line ) { $ bytes = 0 ; $ len = strlen ( $ line ) ; if ( $ len ) { while ( true ) { $ sent = socket_write ( $ this -> client , $ line , $ len ) ; if ( false === $ sent ) { throw new Exceptions \ HttpStatusError ( "Internal server error." , 500 ) ; } $ bytes += $ sent ; if ( $ sent < $ len ) { $ line = substr ( $ line , $ sent ) ; $ len -= $ sent ; } else { break ; } } } return $ bytes ; }
Sends a string through the client socket

Returns the number of bytes sent.

@param  string $line The string to send
@return int
@throws Exceptions\HttpStatusError
Sends a string through the client socket