IPv6(host::Integer) -> IPv6

Returns IPv6 object from ip address formatted as Integer


  1. Convert an IPv6 address from Integer to IPv6 object:

    julia> ip_int = 42540528726086948282005740903761766848;
    julia> ip = IPv6(ip_int)

    This example converts the IPv6 address represented as an integer (ip_int) into an IPv6 object (ip).

  2. Access properties of the IPv6 object:

    julia> ip = IPv6(42540528726086948282005740903761766848);
    julia> ip.address
    julia> ip.version

    It demonstrates how to access the address and version properties of the IPv6 object.

  3. 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 a println 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.

*Required Field

Checking you are not a robot: