Implement connecting to the server