With the "okay" variable, you basically track if the value for the IP address is valid. But it's implicitely the same by the else-block. If the translation of the IP address neither succeeds for AF_INET nor for AF_INET6, the else-block handles this exception.