minor sockets related refactoring