IPv6
IPv6(host::Integer) -> IPv6
Returns IPv6 object from ip address formatted as Integer
Examples
-
Convert an IPv6 address from Integer to IPv6 object:
julia> ip_int = 42540528726086948282005740903761766848; julia> ip = IPv6(ip_int) IPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
This example converts the IPv6 address represented as an integer (
ip_int
) into anIPv6
object (ip
). -
Access properties of the IPv6 object:
julia> ip = IPv6(42540528726086948282005740903761766848); julia> ip.address "2001:0db8:85a3:0000:0000:8a2e:0370:7334" julia> ip.version "IPv6"
It demonstrates how to access the address and version properties of the
IPv6
object. - Use the IPv6 object in functions or operations:
julia> ip = IPv6(42540528726086948282005740903761766848); julia> println("IP Address: ", ip) IP Address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Here, the
IPv6
object is used in aprintln
statement to display the IP address.
Common mistake example:
julia> ip = IPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
ERROR: MethodError: no method matching IPv6(::String)
In this example, the input to the IPv6
constructor is a string instead of an integer. Make sure to provide the IP address as an integer when using the IPv6
function.
See Also
accept, bind, :@spawn, connect, fetch, getaddrinfo, gethostname, getipaddr, getsockname, init_worker, IPv4, IPv6, isready, issocket, kill, listen, recv, recvfrom, remotecall, remotecall_fetch, remotecall_wait, RemoteRef, send, setopt,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.