refactored zsocket