You are confused.
In $iif(c,t,f), the t part means "what you should put if the condition evalutes to "$true" and the f part what you should put when the condition evaluates to "$false"
Let's change it to be an /if and then you will see why what you say makes no sense.
if ($sockerr) {
; an error has occured
echo -a $true - $sock($sockname).ip
}
else {
; connection successful
echo -a $false
}
As you can see, that's exactly the other way round of what we want. We want to echo $false if the condition was $true, with the condition being that there was an error.
if ($sockerr) will be $true if there was an error, thus we want to echo $false in this case.
So the correct /if would be:
if ($sockerr) {
; there was an error
echo -a $false
}
else {
; connection successful
echo -a $true - $sock($sockname).ip
}
For your $iif to be correct you would have to have specified:
$iif(!$sockerr,$true - $sock($sockname).ip,$false)
The $true and $false that we want to echo say something about how the connection with the socket went. If it went successful, then we want to echo $true, if it didn't go sucessful (there was an error that made $sockerr have a value), we want to echo $false.