refactor and cleanups between socks and tcp