added more socket server logic