private function readVerified($fd, $len) { if ($len != strlen($data = fread($fd, $len))) { throw new Exception("Unexpected EOF"); } return $data; }