Refactored socket support

* Made the socketutil work and look better.
Fixed printouts

* Some printouts in the socket util was server specific.