Does " All continuous functions are bounded " or " All continuous functions attain a maximum " or together imply the domain is compact? Let $(X,d)$ be an infinite metric space satisfying H1 or H2 or both.  
H1: (All continuous functions on X to $\mathbb{R}$ are bounded.)
If $f: X\to\mathbb{R}$ is continuous on $X$, then $f(x)$ is bounded.  
H2: (All continuous functions on $X$ to $\mathbb{R}$ attain a maximum.)
If $f: X\to\mathbb{R}$ is continuous on $X$, then there exists at least one point $p \in X $ such that $f(p) \geq f(x)$ for every $x \in X.  $
Question
Does H1 only or does H2 only imply $X$ is compact?
Do H1 and H2 together imply $X$ is compact?
Note:
I know " If $X$ is compact then all continuous functions on $X$ to $\mathbb{R}$ are bounded " and " If $X$ is compact then all continuous functions on $X$ to $\mathbb{R}$ attain a maximum ". I am just curious about whether or not the converse still hold.
 A: Properties H1 and H2 are defined for arbitrary toplogical spaces $X$. If $X$ satisfies H1, it is called pseudocompact. See https://en.wikipedia.org/wiki/Pseudocompact_space.
Clearly H2 implies H1. The converse holds for Tychonoff-spaces (= completely regular spaces). See Theorem 27 in
Hewitt, Edwin. "Rings of real-valued continuous functions. I." Transactions of the American Mathematical Society 64.1 (1948): 45-99
Theorem 30 in this paper states that a normal space is pseudocompact if and only if it is compact.
This gives a complete answer to your question.
A: H1 $\Longrightarrow (X$ is compact).  
Suppose $X$ is not compact.  Then there is a sequence $x_n \in X$ with no subsequence that converges in $X$.  (For a metric space, "compact" and "sequentially compact" are equivalent.)    Taking a subsequence, we may assume WLOG that all $x_n$ are distinct.  The set $E= \{x_n : n \in \mathbb N\}$ is closed in $X$.  The set $E$ has the discrete topology.  The unbounded function $x_n \mapsto n$ is therefore continuous on $E$.  A continuous real-valued function on a closed subset of a metric space extends to a continuous real-valued function on the whole space.  That will be an unbounded continuous function on $X$.
As noted, H2 $\Longrightarrow$ H1 is easy, so we also get 
H2 $\Longrightarrow (X$ is compact).
[I would guess this was known for metric spaces long before Hewitt's great paper in 1948; and the substance of Hewitt's paper was exploring what happens in non-meric spaces.]
