function sendData($data, $flags = null)
    {
        $rHandler = $this->resource()->getRHandler();

        if ($flags === null) {
            if ($this->resource()->meta()->getStreamType() == 'udp_socket')
                // STREAM_OOB data not provided on udp sockets
                $flags = STREAM_PEEK;
            else
                $flags = STREAM_SOCK_RDM;
        }

        $ret = @stream_socket_sendto($rHandler, $data, $flags);

        if ($ret == -1) {
            $lerror = error_get_last();
            throw new \RuntimeException(sprintf(
                'Cannot send data on stream, %s.',
                $lerror['message']
            ));
        }


        $this->_resetTransCount($ret);

        return $this;
    }
function sendData($data, $flags = null)
    {
        $rHandler = $this->resource()->getRHandler();

        if ($flags === null) {
            if ($this->resource()->meta()->getStreamType() == 'udp_socket')
                // STREAM_OOB data not provided on udp sockets
                $flags = STREAM_PEEK;
            else
                $flags = STREAM_SOCK_RDM;
        }

        $ret = @stream_socket_sendto($rHandler, $data, $flags);

        if ($ret == -1) {
            $lerror = error_get_last();
            throw new \RuntimeException(sprintf(
                'Cannot send data on stream, %s.',
                $lerror['message']
            ));
        }


        $this->_resetTransCount($ret);

        return $this;
    }
function sendData ( $ data , $ flags = null ) { $ rHandler = $ this -> resource ( ) -> getRHandler ( ) ; if ( $ flags === null ) { if ( $ this -> resource ( ) -> meta ( ) -> getStreamType ( ) == 'udp_socket' ) // STREAM_OOB data not provided on udp sockets $ flags = STREAM_PEEK ; else $ flags = STREAM_SOCK_RDM ; } $ ret = @ stream_socket_sendto ( $ rHandler , $ data , $ flags ) ; if ( $ ret == - 1 ) { $ lerror = error_get_last ( ) ; throw new \ RuntimeException ( sprintf ( 'Cannot send data on stream, %s.' , $ lerror [ 'message' ] ) ) ; } $ this -> _resetTransCount ( $ ret ) ; return $ this ; }
Sends the specified data through the socket,
whether it is connected or not

@param string   $data  The data to be sent
@param int|null $flags Provides a RDM (Reliably-delivered messages) socket
The value of flags can be any combination of the following:
- STREAM_SOCK_RDM
- STREAM_PEEK
- STREAM_OOB       process OOB (out-of-band) data
- null             auto choose the value

@return $this
Sends the specified data through the socket whether it is connected or not