- fcntl($sock, F_SETFL, O_NONBLOCK) - or die "Can't set socket non-blocking: $!"; + defined( $sock->blocking(0) ) + or die "Can't set socket non-blocking: ${\int$!} : $!";