Exemple #1
0
def dqtoi(dq):
    """Return an integer value given an IP address as dotted-quad string.
    You can also supply the address as a a host name.
    """
    try:
        s = socket.inet_aton(dq)
    except socket.error as why:
        raise ValueError(why)
    return (ord(s[0]) << 24) + (ord(s[1]) << 16) + (ord(s[2]) << 8) + (ord(s[3]))
Exemple #2
0
def dqtoi(dq):
    """Return an integer value given an IP address as dotted-quad string.
    You can also supply the address as a a host name.
    """
    try:
        s = socket.inet_aton(dq)
    except socket.error as why:
        raise ValueError(why)
    return (ord(s[0]) << 24) + (ord(s[1]) << 16) + (ord(s[2]) << 8) + (ord(
        s[3]))
Exemple #3
0
def dqtoi(dq):
    """dqtoi(dotted-quad-string)
Return an integer value given an IP address as dotted-quad string. You can also
supply the address as a a host name. """
    s = buffer(socket.inet_aton(dq))
    return (ord(s[0]) << 24) + (ord(s[1]) << 16) + (ord(s[2]) << 8) + (ord(s[3]))