Refactor the init process, merge the server socket process