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 GSrvTargets
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
ConstructorsConstructorDescriptionSrvTarget(MemorySegment address) Create a SrvTarget proxy instance for the provided memory address.Creates a newGSrvTargetwith the given parameters. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copies this SrvTargetvoidfree()Frees this SrvTargetGetstarget'shostname (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.)shortgetPort()Getstarget'sportshortGetstarget'spriority.static @Nullable TypegetType()Get the GType of the SrvTarget classshortGetstarget'sweight.static List<MemorySegment> listSort(List<MemorySegment> targets) Sortstargetsin place according to the algorithm in RFC 2782.Methods inherited from class org.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 newGSrvTargetwith the given parameters.You should not need to use this; normally
GSrvTargetsare 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- Since:
- 2.22
-
-
Method Details
-
getType
-
listSort
Sortstargetsin place according to the algorithm in RFC 2782.- Parameters:
targets- aGListofGSrvTarget- Returns:
- the head of the sorted list.
- Since:
- 2.22
-
copy
-
free
public void free()Frees this SrvTarget- Since:
- 2.22
-
getHostname
Getstarget'shostname (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:
target'shostname- Since:
- 2.22
-
getPort
public short getPort()Getstarget'sport- Returns:
target'sport- Since:
- 2.22
-
getPriority
public short getPriority()Getstarget'spriority. You should not need to look at this;GResolveralready sorts the targets according to the algorithm in RFC 2782.- Returns:
target'spriority- Since:
- 2.22
-
getWeight
public short getWeight()Getstarget'sweight. You should not need to look at this;GResolveralready sorts the targets according to the algorithm in RFC 2782.- Returns:
target'sweight- Since:
- 2.22
-