Socket fact

Factorized sockets under Stream, also changed the way to handle std streams.