Initial code to connect to a client