added connect method to server and client