network validity checked before connecting.