socket server implementation