![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
GNetworkAddressGNetworkAddress — a GSocketConnectable for resolving hostnames |
#include <gio/gio.h> GNetworkAddress; GSocketConnectable * g_network_address_new (const gchar *hostname, guint16 port); const gchar * g_network_address_get_hostname (GNetworkAddress *addr); guint16 g_network_address_get_port (GNetworkAddress *addr);
"hostname" gchar* : Read / Write / Construct Only "port" guint : Read / Write / Construct Only
GNetworkAddress 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 GSocketConnectable for and example of using the connectable interface.
typedef struct _GNetworkAddress GNetworkAddress;
A GSocketConnectable for resolving a hostname and connecting to that host.
GSocketConnectable * g_network_address_new (const gchar *hostname, guint16 port);
Creates a new GSocketConnectable for connecting to the given
hostname
and port
.
|
the hostname |
|
the port |
Returns : |
the new GNetworkAddress |
Since 2.22
const gchar * g_network_address_get_hostname (GNetworkAddress *addr);
Gets addr
's hostname. This might be either UTF-8 or ASCII-encoded,
depending on what addr
was created with.
|
a GNetworkAddress |
Returns : |
addr 's hostname
|
Since 2.22
guint16 g_network_address_get_port (GNetworkAddress *addr);
Gets addr
's port number
|
a GNetworkAddress |
Returns : |
addr 's port (which may be 0 )
|
Since 2.22