public function receive() {
		// read 4 byte length first
		$hdr = '';
		do {
			$read = socket_read($this->socket, 4 - strlen($hdr));
			if ($read === FALSE) {
				throw new SimpleSocketException('Reception failed with: ' . socket_strerror(socket_last_error($this->socket)));
			}
			elseif ($read === '' || $read === NULL) {
				return NULL;
			}
			$hdr .= $read;
		} while (strlen($hdr) < 4);

		list($len) = array_values(unpack("N", $hdr));

		// read the full buffer
		$buffer = '';
		do {
			$read = socket_read($this->socket, $len - strlen($buffer));
			if ($read === FALSE || $read == '') {
				throw new SimpleSocketException('Reception failed with: ' . socket_strerror(socket_last_error($this->socket)));
			}
			elseif ($read == '') {
				return NULL;
			}
			$buffer .= $read;
		} while (strlen($buffer) < $len);

		$data = unserialize($buffer);
		return $data;
	}