Appreciate the comments, amended accordingly
while (%totalchans) && ($scon(%y).status == connected) {
note: It never occurred to me to check connection status.... narrow vision lol.