:right-sidebar: True SrvTarget =================================================================== .. currentmodule:: gi.repository.Gio .. class:: SrvTarget(**kwargs) :no-contents-entry: A single target host/port that a network service is running on. 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 :obj:`~gi.repository.Gio.Resolver.lookup_service` or :obj:`~gi.repository.Gio.Resolver.lookup_service_async` to find the ``GSrvTarget``\s for a given service. However, if you are simply planning to connect to the remote service, you can use :obj:`~gi.repository.Gio.NetworkService`\’s :obj:`~gi.repository.Gio.SocketConnectable` interface and not need to worry about ``GSrvTarget`` at all. Constructors ------------ .. rst-class:: interim-class .. class:: SrvTarget :no-index: .. classmethod:: new(hostname: str, port: int, priority: int, weight: int) -> ~gi.repository.Gio.SrvTarget Creates a new :obj:`~gi.repository.Gio.SrvTarget` with the given parameters. You should not need to use this; normally :obj:`~gi.repository.Gio.SrvTarget` are created by :obj:`~gi.repository.Gio.Resolver`\. .. versionadded:: 2.22 :param hostname: the host that the service is running on :param port: the port that the service is running on :param priority: the target's priority :param weight: the target's weight Methods ------- .. rst-class:: interim-class .. class:: SrvTarget :no-index: .. method:: free() -> None Frees ``target`` .. versionadded:: 2.22 .. method:: get_hostname() -> str Gets ``target``\'s hostname (in ASCII form; if you are going to present this to the user, you should use :func:`~gi.repository.GLib.hostname_is_ascii_encoded` to check if it contains encoded Unicode segments, and use :func:`~gi.repository.GLib.hostname_to_unicode` to convert it if it does.) .. versionadded:: 2.22 .. method:: get_port() -> int Gets ``target``\'s port .. versionadded:: 2.22 .. method:: get_priority() -> int Gets ``target``\'s priority. You should not need to look at this; :obj:`~gi.repository.Gio.Resolver` already sorts the targets according to the algorithm in RFC 2782. .. versionadded:: 2.22 .. method:: get_weight() -> int Gets ``target``\'s weight. You should not need to look at this; :obj:`~gi.repository.Gio.Resolver` already sorts the targets according to the algorithm in RFC 2782. .. versionadded:: 2.22