Client connect logic