Class SrvTarget
- All Implemented Interfaces:
Proxy
SRV (service) records are used by some network protocols to provide
service-specific aliasing and load-balancing. For example, XMPP
(Jabber) uses SRV records to locate the XMPP server for a domain;
rather than connecting directly to ‘example.com’ or assuming a
specific server hostname like ‘xmpp.example.com’, an XMPP client
would look up the xmpp-client
SRV record for ‘example.com’, and
then connect to whatever host was pointed to by that record.
You can use Resolver.lookupService(java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable)
or
Resolver.lookupServiceAsync(java.lang.String, java.lang.String, java.lang.String, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
to find the GSrvTarget
s
for a given service. However, if you are simply planning to connect
to the remote service, you can use NetworkService
’s
SocketConnectable
interface and not need to worry about
GSrvTarget
at all.
-
Constructor Summary
ConstructorDescriptionSrvTarget
(MemorySegment address) Create a SrvTarget proxy instance for the provided memory address.Creates a newGSrvTarget
with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies this SrvTargetvoid
free()
Frees this SrvTargetGets this SrvTarget's hostname (in ASCII form; if you are going to present this to the user, you should use g_hostname_is_ascii_encoded() to check if it contains encoded Unicode segments, and use g_hostname_to_unicode() to convert it if it does.)short
getPort()
Gets this SrvTarget's portshort
Gets this SrvTarget's priority.static Type
getType()
Get the GType of the SrvTarget classshort
Gets this SrvTarget's weight.static List
<MemorySegment> listSort
(List<MemorySegment> targets) Sortstargets
in place according to the algorithm in RFC 2782.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SrvTarget
Create a SrvTarget proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
SrvTarget
Creates a newGSrvTarget
with the given parameters.You should not need to use this; normally
GSrvTargets
are created byGResolver
.- Parameters:
hostname
- the host that the service is running onport
- the port that the service is running onpriority
- the target's priorityweight
- the target's weight
-
-
Method Details
-
getType
-
listSort
Sortstargets
in place according to the algorithm in RFC 2782.- Parameters:
targets
- aGList
ofGSrvTarget
- Returns:
- the head of the sorted list.
-
copy
-
free
public void free()Frees this SrvTarget -
getHostname
Gets this SrvTarget's hostname (in ASCII form; if you are going to present this to the user, you should use g_hostname_is_ascii_encoded() to check if it contains encoded Unicode segments, and use g_hostname_to_unicode() to convert it if it does.)- Returns:
- this SrvTarget's hostname
-
getPort
public short getPort()Gets this SrvTarget's port- Returns:
- this SrvTarget's port
-
getPriority
public short getPriority()Gets this SrvTarget's priority. You should not need to look at this;GResolver
already sorts the targets according to the algorithm in RFC 2782.- Returns:
- this SrvTarget's priority
-
getWeight
public short getWeight()Gets this SrvTarget's weight. You should not need to look at this;GResolver
already sorts the targets according to the algorithm in RFC 2782.- Returns:
- this SrvTarget's weight
-