src/Socket/VirtualUdpConnection.php
public function send($data): bool
    {
        $dataLength = strlen($data);
        if ($dataLength === 0) {
            throw new \RuntimeException('Can not send an empty package.');
        }
        if ($this->isIpAddress()) {
            $address = $this->peerAddress->getIp();
            $port = $this->peerAddress->getPort();
        } else {
            $address = $this->peerAddress->getSockPath();
            $port = 0;
        }
        $wrote = socket_sendto($this->connectionResource->getResource(), $data, strlen($data), 0, $address, $port);
        if ($wrote === false || $wrote === 0) {
//            throw new SendException('I don\'t send :(');
            return false;
        } elseif ($wrote < $dataLength) {
            throw new SendException('Could not send the whole package.');
        }
        return true;
    }
public function send($data): bool
    {
        $dataLength = strlen($data);
        if ($dataLength === 0) {
            throw new \RuntimeException('Can not send an empty package.');
        }
        if ($this->isIpAddress()) {
            $address = $this->peerAddress->getIp();
            $port = $this->peerAddress->getPort();
        } else {
            $address = $this->peerAddress->getSockPath();
            $port = 0;
        }
        $wrote = socket_sendto($this->connectionResource->getResource(), $data, strlen($data), 0, $address, $port);
        if ($wrote === false || $wrote === 0) {
//            throw new SendException('I don\'t send :(');
            return false;
        } elseif ($wrote < $dataLength) {
            throw new SendException('Could not send the whole package.');
        }
        return true;
    }
public function send ( $ data ) : bool { $ dataLength = strlen ( $ data ) ; if ( $ dataLength === 0 ) { throw new \ RuntimeException ( 'Can not send an empty package.' ) ; } if ( $ this -> isIpAddress ( ) ) { $ address = $ this -> peerAddress -> getIp ( ) ; $ port = $ this -> peerAddress -> getPort ( ) ; } else { $ address = $ this -> peerAddress -> getSockPath ( ) ; $ port = 0 ; } $ wrote = socket_sendto ( $ this -> connectionResource -> getResource ( ) , $ data , strlen ( $ data ) , 0 , $ address , $ port ) ; if ( $ wrote === false || $ wrote === 0 ) { //            throw new SendException('I don\'t send :('); return false ; } elseif ( $ wrote < $ dataLength ) { throw new SendException ( 'Could not send the whole package.' ) ; } return true ; }
@param $data

@return bool
@throws SendException
@param $data