The connecting flag should be set to false initially