public function read(ByteBuffer $destinationBuffer) { $length = $destinationBuffer->remaining(); $data = $this->socket->recv($length); $destinationBuffer->put($data); return strlen($data); }
public function recvFrom(Socket $socket) { $data = $socket->recv(); if (!$socket instanceof self) { $data = $this->decode($data); } return $data; }