add socket min to client, and some refactoring