public function send($data) {
		$serialized = serialize($data);
		$hdr = pack('N', strlen($serialized)); // 4 byte length
		$buffer = $hdr . $serialized;
		unset($serialized);
		unset($hdr);
		$total = strlen($buffer);
		while ($total > 0) {
			$sent = socket_write($this->socket, $buffer);
			if ($sent === FALSE) {
				throw new SimpleSocketException('Sending failed with: ' . socket_strerror(socket_last_error($this->socket)));
			}
			$total -= $sent;
			$buffer = substr($buffer, $sent);
		}
	}