def inet_pton(space, family, ip): """inet_pton(family, ip) -> packed IP address string Convert an IP address from string format to a packed string suitable for use with low-level network functions. """ try: buf = rsocket.inet_pton(family, ip) except SocketError, e: raise converted_error(space, e)
def inet_pton(space, address): """ Converts a human readable IP address to its packed in_addr representation""" n = rsocket.inet_pton(rsocket.AF_INET, address) return space.newstr(n)