completed socket server and client