Check connected state before handling packets.