public function send($buffer, $flags = 0, $length = null)
    {
        if (null === $length) {
            $length = strlen($buffer);
        }

        // make sure everything is written
        do {
            $return = @socket_send($this->resource, $buffer, $length, $flags);

            if (false !== $return && $return < $length) {
                $buffer = substr($buffer, $return);
                $length -= $return;
            } else {
                break;
            }
        } while (true);

        if ($return === false) {
            throw new SocketException($this->resource);
        }

        return $return;
    }
public function send($buffer, $flags = 0, $length = null)
    {
        if (null === $length) {
            $length = strlen($buffer);
        }

        // make sure everything is written
        do {
            $return = @socket_send($this->resource, $buffer, $length, $flags);

            if (false !== $return && $return < $length) {
                $buffer = substr($buffer, $return);
                $length -= $return;
            } else {
                break;
            }
        } while (true);

        if ($return === false) {
            throw new SocketException($this->resource);
        }

        return $return;
    }
public function send ( $ buffer , $ flags = 0 , $ length = null ) { if ( null === $ length ) { $ length = strlen ( $ buffer ) ; } // make sure everything is written do { $ return = @ socket_send ( $ this -> resource , $ buffer , $ length , $ flags ) ; if ( false !== $ return && $ return < $ length ) { $ buffer = substr ( $ buffer , $ return ) ; $ length -= $ return ; } else { break ; } } while ( true ) ; if ( $ return === false ) { throw new SocketException ( $ this -> resource ) ; } return $ return ; }
Sends data to a connected socket.

<p>Sends length bytes to the socket from buffer.</p>

@param string $buffer A buffer containing the data that will be sent to the remote host.
@param int    $flags  <p>The value of flags can be any combination of the following flags, joined with the binary OR
(<code>|</code>) operator.<ul><li><code>MSG_OOB</code> - Send OOB (out-of-band) data.</li><li>
<code>MSG_EOR</code> - Indicate a record mark. The sent data completes the record.</li><li><code>MSG_EOF</code> -
Close the sender side of the socket and include an appropriate notification of this at the end of the sent data.
The sent data completes the transaction.</li><li><code>MSG_DONTROUTE</code> - Bypass routing, use direct
interface.</li></ul></p>
@param int    $length The number of bytes that will be sent to the remote host from buffer.

@throws Exception\SocketException If there was a failure.

@return int Returns the number of bytes sent.
Sends data to a connected socket .