Finished socket server implementation