Telnet question using groovy in HE

Hello, does anyone know of a way to check if a telnet connection is still active when issuing a hub command as such? I'm aware of telnetStatus() receiving the status, but this method is invoked after the fact... I would like to catch if the following command fails synchronously. Anyone?

return new hubitat.device.HubAction("${msg}\n", hubitat.device.Protocol.TELNET )

I don’t believe you can because the command itself is sent asynchronously. Basically it’s in a queue and it won’t fail until that queue executes. So it doesn’t fail synchronously.

Okay, thanks. Is there a way to check if the queue is actively connected at a minimum?

Send something and check.for a replu. I used telnet to make an email send notification device with no log in. Ie basic Unix send mail.