Wrote some reasonable sockets code properly and not too lazy!

Thanks Jesus!