I fail to see the problem.

The item after the first comma in a $iif statement is what is returned if the condition in the $iif is true.
Using your command, if $sock(test) is true then echo Yes
So if the socket test is active, you should see Yes
Which is exactly what you are seeing (according to the line
Quote:
does work, even though the socket is open.