public function send($data) {
        if($this->socketsEnabled) {
            $sendResult = socket_send($this->socket, $data, strlen($data), 0);
            if ($sendResult === false) {
                throw new SocketException(socket_last_error($this->socket));
            }
        } else {
            $sendResult = fwrite($this->socket, $data, strlen($data));
            if ($sendResult === false) {
                throw new SocketException('Could not send data.');
            }
        }
    }
public function send($data) {
        if($this->socketsEnabled) {
            $sendResult = socket_send($this->socket, $data, strlen($data), 0);
            if ($sendResult === false) {
                throw new SocketException(socket_last_error($this->socket));
            }
        } else {
            $sendResult = fwrite($this->socket, $data, strlen($data));
            if ($sendResult === false) {
                throw new SocketException('Could not send data.');
            }
        }
    }
public function send ( $ data ) { if ( $ this -> socketsEnabled ) { $ sendResult = socket_send ( $ this -> socket , $ data , strlen ( $ data ) , 0 ) ; if ( $ sendResult === false ) { throw new SocketException ( socket_last_error ( $ this -> socket ) ) ; } } else { $ sendResult = fwrite ( $ this -> socket , $ data , strlen ( $ data ) ) ; if ( $ sendResult === false ) { throw new SocketException ( 'Could not send data.' ) ; } } }
Sends the specified data to the peer this socket is connected to

@param string $data The data to send to the connected peer
@throws SocketException if sending fails
Sends the specified data to the peer this socket is connected to