Thank you. After making over a dozen versions I didn't know what the problem was. You removed all cruft and made it nice.
1: $thrcnt does not increment.
Considering my approach.
The posted example is very lightweight, but in the real application the processing routine is timeconsuming and not lightweight. The
number of connects are expected to be limited to <100/hour,
and a restart every 24hours. Not a problem.