rendered paste body private function rawPacketRead() { // check if there is anything on the other side of the socket. $packets = array(); $read = array($this->_socket); while(socket_select($read,$write = NULL, $except = NULL, 0, $this->_readTimeout)) { $length = socket_read($read[0],4); $packetLength = unpack('V1PacketLength', $length); if ($packetLength['PacketLength'] > 4096) $packet = "\x00\x00\x00\x00\x00\x00\x00\x00".socket_read($this->_socket, 4096); else $packet = socket_read($this->_socket, $packetLength['PacketLength']); array_push($packets, unpack('V1RequestID/V1CommandResponse/a*String1/a*String2',$packet)); } return $packets; }