Refactor socket stuff. BUILD BREAKING.