set(addr, *family)
protected
Set +@addr+, the internal stored ip address, to
given addr. The parameter addr is validated using the
first family member, which is +Socket::AF_INET+ or
+Socket::AF_INET6+.
Show source
def set(addr, *family)
case family[0] ? family[0] : @family
when Socket::AF_INET
if addr < 0 || addr > IN4MASK
raise InvalidAddressError, "invalid address"
end
when Socket::AF_INET6
if addr < 0 || addr > IN6MASK
raise InvalidAddressError, "invalid address"
end
else
raise AddressFamilyError, "unsupported address family"
end
@addr = addr
if family[0]
@family = family[0]
end
return self
end