alias test_socket {
set -e %socket_time $ticks
sockopen test_socket www.google.com 80
}
on *:sockopen:test_socket:{
echo -a Time: $calc(($ticks - %socket_time) / 1000) seconds
unset %socket_time
if ($sockerr > 0) {
echo -a Connection failed: $sockerr / $sock($sockname).wsmsg
return
}
echo -a Connection successful
sockclose $sockname
}