Socket server implementation.