Object Hierarchy:

Object hierarchy for NetworkAddress


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.

See SocketConnectable for an example of using the connectable interface.

Example: Network addresses:

public static int main (string[] args) {
// Determine whether can be reached: (sync):

NetworkMonitor monitor = NetworkMonitor.get_default ();
NetworkAddress address = new NetworkAddress ("", 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

Namespace: GLib
Package: gio-2.0



Static methods:

Creation methods:


Inherited Members:

All known members inherited from interface GLib.SocketConnectable