Setting up connection to server