Let $X$ be a topological space and denote by $\pi_0(X)$ its space of connected components i.e. the set of connected components of $X$ with the quotient topology induced by the topology of $X$. Note that $\pi_0(X)$ is discrete if and only if every connected component of $X$ is open in $X$ (this is always the case if $X$ has only a finite number of connected components but not true in general).
My question is : can $X$ be reconstructed from the set of its connected components (view as topological spaces with the induced topology) and $\pi_0(X)$ as a topological space.
Here are two example where it is possible : $\pi_0(X)$ is discrete because in this case $X$ is just the disjoint union of its connected components, $X$ is totally disconected because in this case $X$ is homemorphic to $\pi_0(X)$.