My IP checker is checking if IP is technically valid, I want to check if it's online : <pre><code>import socket

def is_valid_ipv4_address(address):
    try:
        socket.inet_pton(socket.AF_INET, address)
    except AttributeError:  # no inet_pton here, sorry
        try:
            socket.inet_pton()
        except socket.error:
            return False
        return address.count('.') == 3
    except socket.error:  # not a valid address
        return False

    return True

def is_valid_ipv6_address(address):
    try:
        socket.inet_pton(socket.AF_INET6, address)
    except AttributeError:  # no inet_pton here, sorry
        try:
            socket.inet_pton()
        except socket.error:
            return False
        return address.count('.') == 3
    except socket.error:  # not a valid address
        return False

    return True

def checkStatus():
    websiteToCheck = input("Enter IP: ").replace(" ", "")
    if is_valid_ipv4_address(websiteToCheck) or is_valid_ipv6_address(websiteToCheck):
        print("Valid")
    elif len(websiteToCheck) == 0:
        print("Please input something")
    else:
        print("Invalid")

checkStatus()
</code></pre>

<p>It gives the expected output when it's not valid, like when the number is over 255, when the input contains letters of the alphabet etc.. However, let's say I input 10.111.111.111 as my IP. It prints "Valid", even though if you tried to access that IP right now you'd fail.</p>

<p>How do I check if an IP is online as opposed to whether it's numerically valid?</p>
