/** * Method to get the response for the request. * @return Packet The complete packet with a response from server. * @since 1.0.0 */ public function receivePacket() { //reset the content which will be received. $response = ''; //receive the response. do { $buffer = socket_read($this->socket, 100); $response .= $buffer; } while (!empty($buffer) && strlen($buffer) == 100); //set the response of the request to the packet. $this->packet->setResponse($response); //return the complete package. return $this->packet; }