예제 #1
0
파일: ipv4.py 프로젝트: bharathi26/pycopia
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]))
예제 #2
0
파일: ipv4.py 프로젝트: wildone/pycopia
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]))
예제 #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]))