Class InetAddress

All Implemented Interfaces:
PointerInterface

public class InetAddress extends Object
#GInetAddress represents an IPv4 or IPv6 internet address. Use
g_resolver_lookup_by_name() or g_resolver_lookup_by_name_async() to
look up the #GInetAddress for a hostname. Use
g_resolver_lookup_by_address() or
g_resolver_lookup_by_address_async() to look up the hostname for a
#GInetAddress.

To actually connect to a remote host, you will need a
#GInetSocketAddress (which includes a #GInetAddress as well as a
port number).

https://docs.gtk.org/gio/class.InetAddress.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newAnyInetAddress

      public static InetAddress newAnyInetAddress(int family)
      Creates a #GInetAddress for the "any" address (unassigned/"don't
      care") for @family.
      Parameters:
      family - the address family
      Returns:
      a new #GInetAddress corresponding to the "any" address for @family. Free the returned object with g_object_unref().
    • newFromStringInetAddress

      public static InetAddress newFromStringInetAddress(@Nonnull Str string)
      Parses @string as an IP address and creates a new #GInetAddress.
      Parameters:
      string - a string representation of an IP address
      Returns:
      a new #GInetAddress corresponding to @string, or %NULL if @string could not be parsed. Free the returned object with g_object_unref().
    • newFromStringInetAddress

      public static InetAddress newFromStringInetAddress(String string)
      Parses @string as an IP address and creates a new #GInetAddress.
      Parameters:
      string - a string representation of an IP address
      Returns:
      a new #GInetAddress corresponding to @string, or %NULL if @string could not be parsed. Free the returned object with g_object_unref().
    • newLoopbackInetAddress

      public static InetAddress newLoopbackInetAddress(int family)
      Creates a #GInetAddress for the loopback address for @family.
      Parameters:
      family - the address family
      Returns:
      a new #GInetAddress corresponding to the loopback address for @family. Free the returned object with g_object_unref().
    • equal

      public boolean equal(@Nonnull InetAddress other_address)
      Checks if two #GInetAddress instances are equal, e.g. the same address.
      Parameters:
      other_address - Another #GInetAddress.
      Returns:
      %TRUE if @address and @other_address are equal, %FALSE otherwise.
    • getFamily

      public int getFamily()
      Gets @address's family
      Returns:
      @address's family
    • getIsAny

      public boolean getIsAny()
      Tests whether @address is the "any" address for its family.
      Returns:
      %TRUE if @address is the "any" address for its family.
    • getIsLinkLocal

      public boolean getIsLinkLocal()
      Tests whether @address is a link-local address (that is, if it
      identifies a host on a local network that is not connected to the
      Internet).
      Returns:
      %TRUE if @address is a link-local address.
    • getIsLoopback

      public boolean getIsLoopback()
      Tests whether @address is the loopback address for its family.
      Returns:
      %TRUE if @address is the loopback address for its family.
    • getIsMcGlobal

      public boolean getIsMcGlobal()
      Tests whether @address is a global multicast address.
      Returns:
      %TRUE if @address is a global multicast address.
    • getIsMcLinkLocal

      public boolean getIsMcLinkLocal()
      Tests whether @address is a link-local multicast address.
      Returns:
      %TRUE if @address is a link-local multicast address.
    • getIsMcNodeLocal

      public boolean getIsMcNodeLocal()
      Tests whether @address is a node-local multicast address.
      Returns:
      %TRUE if @address is a node-local multicast address.
    • getIsMcOrgLocal

      public boolean getIsMcOrgLocal()
      Tests whether @address is an organization-local multicast address.
      Returns:
      %TRUE if @address is an organization-local multicast address.
    • getIsMcSiteLocal

      public boolean getIsMcSiteLocal()
      Tests whether @address is a site-local multicast address.
      Returns:
      %TRUE if @address is a site-local multicast address.
    • getIsMulticast

      public boolean getIsMulticast()
      Tests whether @address is a multicast address.
      Returns:
      %TRUE if @address is a multicast address.
    • getIsSiteLocal

      public boolean getIsSiteLocal()
      Tests whether @address is a site-local address such as 10.0.0.1
      (that is, the address identifies a host on a local network that can
      not be reached directly from the Internet, but which may have
      outgoing Internet connectivity via a NAT or firewall).
      Returns:
      %TRUE if @address is a site-local address.
    • getNativeSize

      public long getNativeSize()
      Gets the size of the native raw binary address for @address. This
      is the size of the data that you get from g_inet_address_to_bytes().
      Returns:
      the number of bytes used for the native version of @address.
    • toStr

      public Str toStr()
      Converts @address to string form.
      Returns:
      a representation of @address as a string, which should be freed after use.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()