Class NetworkService

All Implemented Interfaces:
PointerInterface

public class NetworkService extends Object
Like #GNetworkAddress does with hostnames, #GNetworkService
provides an easy way to resolve a SRV record, and then attempt to
connect to one of the hosts that implements that service, handling
service priority/weighting, multiple IP addresses, and multiple
address families.

See #GSrvTarget for more information about SRV records, and see
#GSocketConnectable for an example of using the connectable
interface.

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

  • Constructor Details

    • NetworkService

      public NetworkService(PointerContainer pointer)
    • NetworkService

      public NetworkService(@Nonnull Str service, @Nonnull Str protocol, @Nonnull Str domain)
      Creates a new #GNetworkService representing the given @service,
      @protocol, and @domain. This will initially be unresolved; use the
      #GSocketConnectable interface to resolve it.
      Parameters:
      service - the service type to look up (eg, "ldap")
      protocol - the networking protocol to use for @service (eg, "tcp")
      domain - the DNS domain to look up the service in
    • NetworkService

      public NetworkService(String service, String protocol, String domain)
      Creates a new #GNetworkService representing the given @service,
      @protocol, and @domain. This will initially be unresolved; use the
      #GSocketConnectable interface to resolve it.
      Parameters:
      service - the service type to look up (eg, "ldap")
      protocol - the networking protocol to use for @service (eg, "tcp")
      domain - the DNS domain to look up the service in
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getDomain

      public Str getDomain()
      Gets the domain that @srv serves. This might be either UTF-8 or
      ASCII-encoded, depending on what @srv was created with.
      Returns:
      @srv's domain name
    • getProtocol

      public Str getProtocol()
      Gets @srv's protocol name (eg, "tcp").
      Returns:
      @srv's protocol name
    • getScheme

      public Str getScheme()
      Gets the URI scheme used to resolve proxies. By default, the service name
      is used as scheme.
      Returns:
      @srv's scheme name
    • getService

      public Str getService()
      Gets @srv's service name (eg, "ldap").
      Returns:
      @srv's service name
    • setScheme

      public void setScheme(@Nonnull Str scheme)
      Set's the URI scheme used to resolve proxies. By default, the service name
      is used as scheme.
      Parameters:
      scheme - a URI scheme
    • setScheme

      public void setScheme(String scheme)
      Set's the URI scheme used to resolve proxies. By default, the service name
      is used as scheme.
      Parameters:
      scheme - a URI scheme
    • asSocketConnectable

      public SocketConnectable asSocketConnectable()
      Implements interface SocketConnectable. Call this to get access to interface functions.
      Returns:
      SocketConnectable
    • 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()