rewrite socket server