NetworkAddress
Object Hierarchy:
GLib.NetworkAddress
GLib.NetworkAddress
GLib.NetworkAddress
GLib.Object
GLib.Object
GLib.Object->GLib.NetworkAddress
GLib.SocketConnectable
GLib.SocketConnectable
GLib.SocketConnectable->GLib.NetworkAddress
Description:
[
CCode ( type_id =
"g_network_address_get_type ()" ) ]
public class NetworkAddress :
Object ,
SocketConnectable
NetworkAddress provides an easy way to resolve a hostname and then attempt to connect to that host, handling
the possibility of multiple IP addresses and multiple address families.
The enumeration results of resolved addresses *may* be cached as long as this object is kept alive which may have unexpected results if
alive for too long.
See SocketConnectable for an example of using the connectable interface.
Example: Network addresses:
public static int main (string [] args) { // // Determine whether valadoc.org can be reached: (sync): // NetworkMonitor monitor = NetworkMonitor.get_default (); NetworkAddress address = new NetworkAddress ("www.valadoc.org" , 80 ); try { bool can_reach = monitor.can_reach (address); print ("can-reach: %s \n " , can_reach.to_string ()); } catch (Error e) { print ("Error: %s \n " , e.message); } return 0 ; }
valac --pkg gio-2.0 GLib.NetworkAddress.vala
Content:
Properties:
public string hostname { get ; construct ; }
public uint port { get ; construct ; }
public string scheme { get ; construct ; }
Static methods:
public static NetworkAddress parse (string host_and_port, uint16 default_port) throws Error
public static NetworkAddress parse_uri (string uri, uint16 default_port) throws Error
Creation methods:
Methods:
public unowned string get_hostname ()
Gets this 's hostname.
public uint16 get_port ()
Gets this 's port number
public unowned string ? get_scheme ()
Gets this 's scheme
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref
All known members inherited from interface GLib.SocketConnectable